xref: /dpdk/drivers/net/qede/qede_debug.h (revision ec55c118792b1deefe8c149e1a2657c1ddc488c1)
1*ec55c118SRasesh Mody /* SPDX-License-Identifier: BSD-3-Clause
2*ec55c118SRasesh Mody  * Copyright (c) 2020 Marvell Semiconductor Inc.
3*ec55c118SRasesh Mody  * All rights reserved.
4*ec55c118SRasesh Mody  * www.marvell.com
5*ec55c118SRasesh Mody  */
6*ec55c118SRasesh Mody 
7*ec55c118SRasesh Mody #ifndef _QED_DEBUG_H
8*ec55c118SRasesh Mody #define _QED_DEBUG_H
9*ec55c118SRasesh Mody 
10*ec55c118SRasesh Mody /* Forward Declaration */
11*ec55c118SRasesh Mody struct ecore_dev;
12*ec55c118SRasesh Mody enum ecore_dbg_features;
13*ec55c118SRasesh Mody 
14*ec55c118SRasesh Mody int qed_dbg_grc(struct ecore_dev *edev, void *buffer, u32 *num_dumped_bytes);
15*ec55c118SRasesh Mody int qed_dbg_grc_size(struct ecore_dev *edev);
16*ec55c118SRasesh Mody int qed_dbg_idle_chk(struct ecore_dev *edev, void *buffer,
17*ec55c118SRasesh Mody 		     u32 *num_dumped_bytes);
18*ec55c118SRasesh Mody int qed_dbg_idle_chk_size(struct ecore_dev *edev);
19*ec55c118SRasesh Mody int qed_dbg_reg_fifo(struct ecore_dev *edev, void *buffer,
20*ec55c118SRasesh Mody 		     u32 *num_dumped_bytes);
21*ec55c118SRasesh Mody int qed_dbg_reg_fifo_size(struct ecore_dev *edev);
22*ec55c118SRasesh Mody int qed_dbg_igu_fifo(struct ecore_dev *edev, void *buffer,
23*ec55c118SRasesh Mody 		     u32 *num_dumped_bytes);
24*ec55c118SRasesh Mody int qed_dbg_igu_fifo_size(struct ecore_dev *edev);
25*ec55c118SRasesh Mody int qed_dbg_protection_override(struct ecore_dev *edev, void *buffer,
26*ec55c118SRasesh Mody 				u32 *num_dumped_bytes);
27*ec55c118SRasesh Mody int qed_dbg_protection_override_size(struct ecore_dev *edev);
28*ec55c118SRasesh Mody int qed_dbg_fw_asserts(struct ecore_dev *edev, void *buffer,
29*ec55c118SRasesh Mody 		       u32 *num_dumped_bytes);
30*ec55c118SRasesh Mody int qed_dbg_fw_asserts_size(struct ecore_dev *edev);
31*ec55c118SRasesh Mody int qed_dbg_ilt(struct ecore_dev *edev, void *buffer, u32 *num_dumped_bytes);
32*ec55c118SRasesh Mody int qed_dbg_ilt_size(struct ecore_dev *edev);
33*ec55c118SRasesh Mody int qed_dbg_mcp_trace(struct ecore_dev *edev, void *buffer,
34*ec55c118SRasesh Mody 		      u32 *num_dumped_bytes);
35*ec55c118SRasesh Mody int qed_dbg_mcp_trace_size(struct ecore_dev *edev);
36*ec55c118SRasesh Mody int qed_dbg_all_data(struct ecore_dev *edev, void *buffer);
37*ec55c118SRasesh Mody int qed_dbg_all_data_size(struct ecore_dev *edev);
38*ec55c118SRasesh Mody u8 qed_get_debug_engine(struct ecore_dev *edev);
39*ec55c118SRasesh Mody void qed_set_debug_engine(struct ecore_dev *edev, int engine_number);
40*ec55c118SRasesh Mody int qed_dbg_feature(struct ecore_dev *edev, void *buffer,
41*ec55c118SRasesh Mody 		    enum ecore_dbg_features feature, u32 *num_dumped_bytes);
42*ec55c118SRasesh Mody int
43*ec55c118SRasesh Mody qed_dbg_feature_size(struct ecore_dev *edev, enum ecore_dbg_features feature);
44*ec55c118SRasesh Mody 
45*ec55c118SRasesh Mody void qed_dbg_pf_init(struct ecore_dev *edev);
46*ec55c118SRasesh Mody void qed_dbg_pf_exit(struct ecore_dev *edev);
47*ec55c118SRasesh Mody 
48*ec55c118SRasesh Mody /***************************** Public Functions *******************************/
49*ec55c118SRasesh Mody 
50*ec55c118SRasesh Mody /**
51*ec55c118SRasesh Mody  * @brief qed_dbg_set_bin_ptr - Sets a pointer to the binary data with debug
52*ec55c118SRasesh Mody  *	arrays.
53*ec55c118SRasesh Mody  *
54*ec55c118SRasesh Mody  * @param p_hwfn -	    HW device data
55*ec55c118SRasesh Mody  * @param bin_ptr - a pointer to the binary data with debug arrays.
56*ec55c118SRasesh Mody  */
57*ec55c118SRasesh Mody enum dbg_status qed_dbg_set_bin_ptr(struct ecore_hwfn *p_hwfn,
58*ec55c118SRasesh Mody 				    const u8 * const bin_ptr);
59*ec55c118SRasesh Mody 
60*ec55c118SRasesh Mody /**
61*ec55c118SRasesh Mody  * @brief qed_dbg_set_app_ver - Sets the version of the calling app.
62*ec55c118SRasesh Mody  *
63*ec55c118SRasesh Mody  * The application should call this function with the TOOLS_VERSION
64*ec55c118SRasesh Mody  * it compiles with. Must be called before all other debug functions.
65*ec55c118SRasesh Mody  *
66*ec55c118SRasesh Mody  * @return error if one of the following holds:
67*ec55c118SRasesh Mody  *      - the specified app version is not supported
68*ec55c118SRasesh Mody  * Otherwise, returns ok.
69*ec55c118SRasesh Mody  */
70*ec55c118SRasesh Mody enum dbg_status qed_dbg_set_app_ver(u32 ver);
71*ec55c118SRasesh Mody 
72*ec55c118SRasesh Mody /**
73*ec55c118SRasesh Mody  * @brief qed_read_regs - Reads registers into a buffer (using GRC).
74*ec55c118SRasesh Mody  *
75*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
76*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
77*ec55c118SRasesh Mody  * @param buf - Destination buffer.
78*ec55c118SRasesh Mody  * @param addr - Source GRC address in dwords.
79*ec55c118SRasesh Mody  * @param len - Number of registers to read.
80*ec55c118SRasesh Mody  */
81*ec55c118SRasesh Mody void qed_read_regs(struct ecore_hwfn *p_hwfn,
82*ec55c118SRasesh Mody 		   struct ecore_ptt *p_ptt, u32 *buf, u32 addr, u32 len);
83*ec55c118SRasesh Mody 
84*ec55c118SRasesh Mody /**
85*ec55c118SRasesh Mody  * @brief qed_read_fw_info - Reads FW info from the chip.
86*ec55c118SRasesh Mody  *
87*ec55c118SRasesh Mody  * The FW info contains FW-related information, such as the FW version,
88*ec55c118SRasesh Mody  * FW image (main/L2B/kuku), FW timestamp, etc.
89*ec55c118SRasesh Mody  * The FW info is read from the internal RAM of the first Storm that is not in
90*ec55c118SRasesh Mody  * reset.
91*ec55c118SRasesh Mody  *
92*ec55c118SRasesh Mody  * @param p_hwfn -	    HW device data
93*ec55c118SRasesh Mody  * @param p_ptt -	    Ptt window used for writing the registers.
94*ec55c118SRasesh Mody  * @param fw_info -	Out: a pointer to write the FW info into.
95*ec55c118SRasesh Mody  *
96*ec55c118SRasesh Mody  * @return true if the FW info was read successfully from one of the Storms,
97*ec55c118SRasesh Mody  * or false if all Storms are in reset.
98*ec55c118SRasesh Mody  */
99*ec55c118SRasesh Mody bool qed_read_fw_info(struct ecore_hwfn *p_hwfn,
100*ec55c118SRasesh Mody 		      struct ecore_ptt *p_ptt, struct fw_info *fw_info);
101*ec55c118SRasesh Mody /**
102*ec55c118SRasesh Mody  * @brief qed_dbg_grc_config - Sets the value of a GRC parameter.
103*ec55c118SRasesh Mody  *
104*ec55c118SRasesh Mody  * @param p_hwfn -	HW device data
105*ec55c118SRasesh Mody  * @param grc_param -	GRC parameter
106*ec55c118SRasesh Mody  * @param val -		Value to set.
107*ec55c118SRasesh Mody  *
108*ec55c118SRasesh Mody  * @return error if one of the following holds:
109*ec55c118SRasesh Mody  *	- the version wasn't set
110*ec55c118SRasesh Mody  *	- grc_param is invalid
111*ec55c118SRasesh Mody  *	- val is outside the allowed boundaries
112*ec55c118SRasesh Mody  */
113*ec55c118SRasesh Mody enum dbg_status qed_dbg_grc_config(struct ecore_hwfn *p_hwfn,
114*ec55c118SRasesh Mody 				   enum dbg_grc_params grc_param, u32 val);
115*ec55c118SRasesh Mody 
116*ec55c118SRasesh Mody /**
117*ec55c118SRasesh Mody  * @brief qed_dbg_grc_set_params_default - Reverts all GRC parameters to their
118*ec55c118SRasesh Mody  *	default value.
119*ec55c118SRasesh Mody  *
120*ec55c118SRasesh Mody  * @param p_hwfn		- HW device data
121*ec55c118SRasesh Mody  */
122*ec55c118SRasesh Mody void qed_dbg_grc_set_params_default(struct ecore_hwfn *p_hwfn);
123*ec55c118SRasesh Mody /**
124*ec55c118SRasesh Mody  * @brief qed_dbg_grc_get_dump_buf_size - Returns the required buffer size for
125*ec55c118SRasesh Mody  *	GRC Dump.
126*ec55c118SRasesh Mody  *
127*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
128*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
129*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for the GRC Dump
130*ec55c118SRasesh Mody  *	data.
131*ec55c118SRasesh Mody  *
132*ec55c118SRasesh Mody  * @return error if one of the following holds:
133*ec55c118SRasesh Mody  *	- the version wasn't set
134*ec55c118SRasesh Mody  * Otherwise, returns ok.
135*ec55c118SRasesh Mody  */
136*ec55c118SRasesh Mody enum dbg_status qed_dbg_grc_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
137*ec55c118SRasesh Mody 					      struct ecore_ptt *p_ptt,
138*ec55c118SRasesh Mody 					      u32 *buf_size);
139*ec55c118SRasesh Mody 
140*ec55c118SRasesh Mody /**
141*ec55c118SRasesh Mody  * @brief qed_dbg_grc_dump - Dumps GRC data into the specified buffer.
142*ec55c118SRasesh Mody  *
143*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
144*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
145*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the collected GRC data into.
146*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
147*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
148*ec55c118SRasesh Mody  *
149*ec55c118SRasesh Mody  * @return error if one of the following holds:
150*ec55c118SRasesh Mody  *	- the version wasn't set
151*ec55c118SRasesh Mody  *	- the specified dump buffer is too small
152*ec55c118SRasesh Mody  * Otherwise, returns ok.
153*ec55c118SRasesh Mody  */
154*ec55c118SRasesh Mody enum dbg_status qed_dbg_grc_dump(struct ecore_hwfn *p_hwfn,
155*ec55c118SRasesh Mody 				 struct ecore_ptt *p_ptt,
156*ec55c118SRasesh Mody 				 u32 *dump_buf,
157*ec55c118SRasesh Mody 				 u32 buf_size_in_dwords,
158*ec55c118SRasesh Mody 				 u32 *num_dumped_dwords);
159*ec55c118SRasesh Mody /**
160*ec55c118SRasesh Mody  * @brief qed_dbg_idle_chk_get_dump_buf_size - Returns the required buffer size
161*ec55c118SRasesh Mody  *	for idle check results.
162*ec55c118SRasesh Mody  *
163*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
164*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
165*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for the idle check
166*ec55c118SRasesh Mody  *	data.
167*ec55c118SRasesh Mody  *
168*ec55c118SRasesh Mody  * @return error if one of the following holds:
169*ec55c118SRasesh Mody  *	- the version wasn't set
170*ec55c118SRasesh Mody  * Otherwise, returns ok.
171*ec55c118SRasesh Mody  */
172*ec55c118SRasesh Mody enum dbg_status qed_dbg_idle_chk_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
173*ec55c118SRasesh Mody 						   struct ecore_ptt *p_ptt,
174*ec55c118SRasesh Mody 						   u32 *buf_size);
175*ec55c118SRasesh Mody 
176*ec55c118SRasesh Mody /**
177*ec55c118SRasesh Mody  * @brief qed_dbg_idle_chk_dump - Performs idle check and writes the results
178*ec55c118SRasesh Mody  *	into the specified buffer.
179*ec55c118SRasesh Mody  *
180*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
181*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
182*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the idle check data into.
183*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
184*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
185*ec55c118SRasesh Mody  *
186*ec55c118SRasesh Mody  * @return error if one of the following holds:
187*ec55c118SRasesh Mody  *	- the version wasn't set
188*ec55c118SRasesh Mody  *	- the specified buffer is too small
189*ec55c118SRasesh Mody  * Otherwise, returns ok.
190*ec55c118SRasesh Mody  */
191*ec55c118SRasesh Mody enum dbg_status qed_dbg_idle_chk_dump(struct ecore_hwfn *p_hwfn,
192*ec55c118SRasesh Mody 				      struct ecore_ptt *p_ptt,
193*ec55c118SRasesh Mody 				      u32 *dump_buf,
194*ec55c118SRasesh Mody 				      u32 buf_size_in_dwords,
195*ec55c118SRasesh Mody 				      u32 *num_dumped_dwords);
196*ec55c118SRasesh Mody 
197*ec55c118SRasesh Mody /**
198*ec55c118SRasesh Mody  * @brief qed_dbg_mcp_trace_get_dump_buf_size - Returns the required buffer size
199*ec55c118SRasesh Mody  *	for mcp trace results.
200*ec55c118SRasesh Mody  *
201*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
202*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
203*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for mcp trace data.
204*ec55c118SRasesh Mody  *
205*ec55c118SRasesh Mody  * @return error if one of the following holds:
206*ec55c118SRasesh Mody  *	- the version wasn't set
207*ec55c118SRasesh Mody  *	- the trace data in MCP scratchpad contain an invalid signature
208*ec55c118SRasesh Mody  *	- the bundle ID in NVRAM is invalid
209*ec55c118SRasesh Mody  *	- the trace meta data cannot be found (in NVRAM or image file)
210*ec55c118SRasesh Mody  * Otherwise, returns ok.
211*ec55c118SRasesh Mody  */
212*ec55c118SRasesh Mody enum dbg_status qed_dbg_mcp_trace_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
213*ec55c118SRasesh Mody 						    struct ecore_ptt *p_ptt,
214*ec55c118SRasesh Mody 						    u32 *buf_size);
215*ec55c118SRasesh Mody 
216*ec55c118SRasesh Mody /**
217*ec55c118SRasesh Mody  * @brief qed_dbg_mcp_trace_dump - Performs mcp trace and writes the results
218*ec55c118SRasesh Mody  *	into the specified buffer.
219*ec55c118SRasesh Mody  *
220*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
221*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
222*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the mcp trace data into.
223*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
224*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
225*ec55c118SRasesh Mody  *
226*ec55c118SRasesh Mody  * @return error if one of the following holds:
227*ec55c118SRasesh Mody  *	- the version wasn't set
228*ec55c118SRasesh Mody  *	- the specified buffer is too small
229*ec55c118SRasesh Mody  *	- the trace data in MCP scratchpad contain an invalid signature
230*ec55c118SRasesh Mody  *	- the bundle ID in NVRAM is invalid
231*ec55c118SRasesh Mody  *	- the trace meta data cannot be found (in NVRAM or image file)
232*ec55c118SRasesh Mody  *	- the trace meta data cannot be read (from NVRAM or image file)
233*ec55c118SRasesh Mody  * Otherwise, returns ok.
234*ec55c118SRasesh Mody  */
235*ec55c118SRasesh Mody enum dbg_status qed_dbg_mcp_trace_dump(struct ecore_hwfn *p_hwfn,
236*ec55c118SRasesh Mody 				       struct ecore_ptt *p_ptt,
237*ec55c118SRasesh Mody 				       u32 *dump_buf,
238*ec55c118SRasesh Mody 				       u32 buf_size_in_dwords,
239*ec55c118SRasesh Mody 				       u32 *num_dumped_dwords);
240*ec55c118SRasesh Mody 
241*ec55c118SRasesh Mody /**
242*ec55c118SRasesh Mody  * @brief qed_dbg_reg_fifo_get_dump_buf_size - Returns the required buffer size
243*ec55c118SRasesh Mody  *	for grc trace fifo results.
244*ec55c118SRasesh Mody  *
245*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
246*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
247*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for reg fifo data.
248*ec55c118SRasesh Mody  *
249*ec55c118SRasesh Mody  * @return error if one of the following holds:
250*ec55c118SRasesh Mody  *	- the version wasn't set
251*ec55c118SRasesh Mody  * Otherwise, returns ok.
252*ec55c118SRasesh Mody  */
253*ec55c118SRasesh Mody enum dbg_status qed_dbg_reg_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
254*ec55c118SRasesh Mody 						   struct ecore_ptt *p_ptt,
255*ec55c118SRasesh Mody 						   u32 *buf_size);
256*ec55c118SRasesh Mody 
257*ec55c118SRasesh Mody /**
258*ec55c118SRasesh Mody  * @brief qed_dbg_reg_fifo_dump - Reads the reg fifo and writes the results into
259*ec55c118SRasesh Mody  *	the specified buffer.
260*ec55c118SRasesh Mody  *
261*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
262*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
263*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the reg fifo data into.
264*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
265*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
266*ec55c118SRasesh Mody  *
267*ec55c118SRasesh Mody  * @return error if one of the following holds:
268*ec55c118SRasesh Mody  *	- the version wasn't set
269*ec55c118SRasesh Mody  *	- the specified buffer is too small
270*ec55c118SRasesh Mody  *	- DMAE transaction failed
271*ec55c118SRasesh Mody  * Otherwise, returns ok.
272*ec55c118SRasesh Mody  */
273*ec55c118SRasesh Mody enum dbg_status qed_dbg_reg_fifo_dump(struct ecore_hwfn *p_hwfn,
274*ec55c118SRasesh Mody 				      struct ecore_ptt *p_ptt,
275*ec55c118SRasesh Mody 				      u32 *dump_buf,
276*ec55c118SRasesh Mody 				      u32 buf_size_in_dwords,
277*ec55c118SRasesh Mody 				      u32 *num_dumped_dwords);
278*ec55c118SRasesh Mody 
279*ec55c118SRasesh Mody /**
280*ec55c118SRasesh Mody  * @brief qed_dbg_igu_fifo_get_dump_buf_size - Returns the required buffer size
281*ec55c118SRasesh Mody  *	for the IGU fifo results.
282*ec55c118SRasesh Mody  *
283*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
284*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
285*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for the IGU fifo
286*ec55c118SRasesh Mody  *	data.
287*ec55c118SRasesh Mody  *
288*ec55c118SRasesh Mody  * @return error if one of the following holds:
289*ec55c118SRasesh Mody  *	- the version wasn't set
290*ec55c118SRasesh Mody  * Otherwise, returns ok.
291*ec55c118SRasesh Mody  */
292*ec55c118SRasesh Mody enum dbg_status qed_dbg_igu_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
293*ec55c118SRasesh Mody 						   struct ecore_ptt *p_ptt,
294*ec55c118SRasesh Mody 						   u32 *buf_size);
295*ec55c118SRasesh Mody 
296*ec55c118SRasesh Mody /**
297*ec55c118SRasesh Mody  * @brief qed_dbg_igu_fifo_dump - Reads the IGU fifo and writes the results into
298*ec55c118SRasesh Mody  *	the specified buffer.
299*ec55c118SRasesh Mody  *
300*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
301*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
302*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the IGU fifo data into.
303*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
304*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
305*ec55c118SRasesh Mody  *
306*ec55c118SRasesh Mody  * @return error if one of the following holds:
307*ec55c118SRasesh Mody  *	- the version wasn't set
308*ec55c118SRasesh Mody  *	- the specified buffer is too small
309*ec55c118SRasesh Mody  *	- DMAE transaction failed
310*ec55c118SRasesh Mody  * Otherwise, returns ok.
311*ec55c118SRasesh Mody  */
312*ec55c118SRasesh Mody enum dbg_status qed_dbg_igu_fifo_dump(struct ecore_hwfn *p_hwfn,
313*ec55c118SRasesh Mody 				      struct ecore_ptt *p_ptt,
314*ec55c118SRasesh Mody 				      u32 *dump_buf,
315*ec55c118SRasesh Mody 				      u32 buf_size_in_dwords,
316*ec55c118SRasesh Mody 				      u32 *num_dumped_dwords);
317*ec55c118SRasesh Mody 
318*ec55c118SRasesh Mody /**
319*ec55c118SRasesh Mody  * @brief qed_dbg_protection_override_get_dump_buf_size - Returns the required
320*ec55c118SRasesh Mody  *	buffer size for protection override window results.
321*ec55c118SRasesh Mody  *
322*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
323*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
324*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for protection
325*ec55c118SRasesh Mody  *	override data.
326*ec55c118SRasesh Mody  *
327*ec55c118SRasesh Mody  * @return error if one of the following holds:
328*ec55c118SRasesh Mody  *	- the version wasn't set
329*ec55c118SRasesh Mody  * Otherwise, returns ok.
330*ec55c118SRasesh Mody  */
331*ec55c118SRasesh Mody enum dbg_status
332*ec55c118SRasesh Mody qed_dbg_protection_override_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
333*ec55c118SRasesh Mody 					      struct ecore_ptt *p_ptt,
334*ec55c118SRasesh Mody 					      u32 *buf_size);
335*ec55c118SRasesh Mody /**
336*ec55c118SRasesh Mody  * @brief qed_dbg_protection_override_dump - Reads protection override window
337*ec55c118SRasesh Mody  *	entries and writes the results into the specified buffer.
338*ec55c118SRasesh Mody  *
339*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
340*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
341*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the protection override data into.
342*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
343*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
344*ec55c118SRasesh Mody  *
345*ec55c118SRasesh Mody  * @return error if one of the following holds:
346*ec55c118SRasesh Mody  *	- the version wasn't set
347*ec55c118SRasesh Mody  *	- the specified buffer is too small
348*ec55c118SRasesh Mody  *	- DMAE transaction failed
349*ec55c118SRasesh Mody  * Otherwise, returns ok.
350*ec55c118SRasesh Mody  */
351*ec55c118SRasesh Mody enum dbg_status qed_dbg_protection_override_dump(struct ecore_hwfn *p_hwfn,
352*ec55c118SRasesh Mody 						 struct ecore_ptt *p_ptt,
353*ec55c118SRasesh Mody 						 u32 *dump_buf,
354*ec55c118SRasesh Mody 						 u32 buf_size_in_dwords,
355*ec55c118SRasesh Mody 						 u32 *num_dumped_dwords);
356*ec55c118SRasesh Mody /**
357*ec55c118SRasesh Mody  * @brief qed_dbg_fw_asserts_get_dump_buf_size - Returns the required buffer
358*ec55c118SRasesh Mody  *	size for FW Asserts results.
359*ec55c118SRasesh Mody  *
360*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
361*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
362*ec55c118SRasesh Mody  * @param buf_size - OUT: required buffer size (in dwords) for FW Asserts data.
363*ec55c118SRasesh Mody  *
364*ec55c118SRasesh Mody  * @return error if one of the following holds:
365*ec55c118SRasesh Mody  *	- the version wasn't set
366*ec55c118SRasesh Mody  * Otherwise, returns ok.
367*ec55c118SRasesh Mody  */
368*ec55c118SRasesh Mody enum dbg_status qed_dbg_fw_asserts_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
369*ec55c118SRasesh Mody 						     struct ecore_ptt *p_ptt,
370*ec55c118SRasesh Mody 						     u32 *buf_size);
371*ec55c118SRasesh Mody /**
372*ec55c118SRasesh Mody  * @brief qed_dbg_fw_asserts_dump - Reads the FW Asserts and writes the results
373*ec55c118SRasesh Mody  *	into the specified buffer.
374*ec55c118SRasesh Mody  *
375*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
376*ec55c118SRasesh Mody  * @param p_ptt - Ptt window used for writing the registers.
377*ec55c118SRasesh Mody  * @param dump_buf - Pointer to write the FW Asserts data into.
378*ec55c118SRasesh Mody  * @param buf_size_in_dwords - Size of the specified buffer in dwords.
379*ec55c118SRasesh Mody  * @param num_dumped_dwords - OUT: number of dumped dwords.
380*ec55c118SRasesh Mody  *
381*ec55c118SRasesh Mody  * @return error if one of the following holds:
382*ec55c118SRasesh Mody  *	- the version wasn't set
383*ec55c118SRasesh Mody  *	- the specified buffer is too small
384*ec55c118SRasesh Mody  * Otherwise, returns ok.
385*ec55c118SRasesh Mody  */
386*ec55c118SRasesh Mody enum dbg_status qed_dbg_fw_asserts_dump(struct ecore_hwfn *p_hwfn,
387*ec55c118SRasesh Mody 					struct ecore_ptt *p_ptt,
388*ec55c118SRasesh Mody 					u32 *dump_buf,
389*ec55c118SRasesh Mody 					u32 buf_size_in_dwords,
390*ec55c118SRasesh Mody 					u32 *num_dumped_dwords);
391*ec55c118SRasesh Mody 
392*ec55c118SRasesh Mody /**
393*ec55c118SRasesh Mody  * @brief qed_dbg_read_attn - Reads the attention registers of the specified
394*ec55c118SRasesh Mody  * block and type, and writes the results into the specified buffer.
395*ec55c118SRasesh Mody  *
396*ec55c118SRasesh Mody  * @param p_hwfn -	 HW device data
397*ec55c118SRasesh Mody  * @param p_ptt -	 Ptt window used for writing the registers.
398*ec55c118SRasesh Mody  * @param block -	 Block ID.
399*ec55c118SRasesh Mody  * @param attn_type -	 Attention type.
400*ec55c118SRasesh Mody  * @param clear_status - Indicates if the attention status should be cleared.
401*ec55c118SRasesh Mody  * @param results -	 OUT: Pointer to write the read results into
402*ec55c118SRasesh Mody  *
403*ec55c118SRasesh Mody  * @return error if one of the following holds:
404*ec55c118SRasesh Mody  *	- the version wasn't set
405*ec55c118SRasesh Mody  * Otherwise, returns ok.
406*ec55c118SRasesh Mody  */
407*ec55c118SRasesh Mody enum dbg_status qed_dbg_read_attn(struct ecore_hwfn *p_hwfn,
408*ec55c118SRasesh Mody 				  struct ecore_ptt *p_ptt,
409*ec55c118SRasesh Mody 				  enum block_id block,
410*ec55c118SRasesh Mody 				  enum dbg_attn_type attn_type,
411*ec55c118SRasesh Mody 				  bool clear_status,
412*ec55c118SRasesh Mody 				  struct dbg_attn_block_result *results);
413*ec55c118SRasesh Mody 
414*ec55c118SRasesh Mody /**
415*ec55c118SRasesh Mody  * @brief qed_dbg_print_attn - Prints attention registers values in the
416*ec55c118SRasesh Mody  *	specified results struct.
417*ec55c118SRasesh Mody  *
418*ec55c118SRasesh Mody  * @param p_hwfn
419*ec55c118SRasesh Mody  * @param results - Pointer to the attention read results
420*ec55c118SRasesh Mody  *
421*ec55c118SRasesh Mody  * @return error if one of the following holds:
422*ec55c118SRasesh Mody  *	- the version wasn't set
423*ec55c118SRasesh Mody  * Otherwise, returns ok.
424*ec55c118SRasesh Mody  */
425*ec55c118SRasesh Mody enum dbg_status qed_dbg_print_attn(struct ecore_hwfn *p_hwfn,
426*ec55c118SRasesh Mody 				   struct dbg_attn_block_result *results);
427*ec55c118SRasesh Mody 
428*ec55c118SRasesh Mody /******************************* Data Types **********************************/
429*ec55c118SRasesh Mody 
430*ec55c118SRasesh Mody struct mcp_trace_format {
431*ec55c118SRasesh Mody 	u32 data;
432*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_MODULE_MASK	0x0000ffff
433*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_MODULE_OFFSET	0
434*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_LEVEL_MASK	0x00030000
435*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_LEVEL_OFFSET	16
436*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P1_SIZE_MASK	0x000c0000
437*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P1_SIZE_OFFSET 18
438*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P2_SIZE_MASK	0x00300000
439*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P2_SIZE_OFFSET 20
440*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P3_SIZE_MASK	0x00c00000
441*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_P3_SIZE_OFFSET 22
442*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_LEN_MASK	0xff000000
443*ec55c118SRasesh Mody #define MCP_TRACE_FORMAT_LEN_OFFSET	24
444*ec55c118SRasesh Mody 
445*ec55c118SRasesh Mody 	char *format_str;
446*ec55c118SRasesh Mody };
447*ec55c118SRasesh Mody 
448*ec55c118SRasesh Mody /* MCP Trace Meta data structure */
449*ec55c118SRasesh Mody struct mcp_trace_meta {
450*ec55c118SRasesh Mody 	u32 modules_num;
451*ec55c118SRasesh Mody 	char **modules;
452*ec55c118SRasesh Mody 	u32 formats_num;
453*ec55c118SRasesh Mody 	struct mcp_trace_format *formats;
454*ec55c118SRasesh Mody 	bool is_allocated;
455*ec55c118SRasesh Mody };
456*ec55c118SRasesh Mody 
457*ec55c118SRasesh Mody /* Debug Tools user data */
458*ec55c118SRasesh Mody struct dbg_tools_user_data {
459*ec55c118SRasesh Mody 	struct mcp_trace_meta mcp_trace_meta;
460*ec55c118SRasesh Mody 	const u32 *mcp_trace_user_meta_buf;
461*ec55c118SRasesh Mody };
462*ec55c118SRasesh Mody 
463*ec55c118SRasesh Mody /******************************** Constants **********************************/
464*ec55c118SRasesh Mody 
465*ec55c118SRasesh Mody #define MAX_NAME_LEN	16
466*ec55c118SRasesh Mody 
467*ec55c118SRasesh Mody /***************************** Public Functions *******************************/
468*ec55c118SRasesh Mody 
469*ec55c118SRasesh Mody /**
470*ec55c118SRasesh Mody  * @brief qed_dbg_user_set_bin_ptr - Sets a pointer to the binary data with
471*ec55c118SRasesh Mody  *	debug arrays.
472*ec55c118SRasesh Mody  *
473*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
474*ec55c118SRasesh Mody  * @param bin_ptr - a pointer to the binary data with debug arrays.
475*ec55c118SRasesh Mody  */
476*ec55c118SRasesh Mody enum dbg_status qed_dbg_user_set_bin_ptr(struct ecore_hwfn *p_hwfn,
477*ec55c118SRasesh Mody 					 const u8 * const bin_ptr);
478*ec55c118SRasesh Mody 
479*ec55c118SRasesh Mody /**
480*ec55c118SRasesh Mody  * @brief qed_dbg_alloc_user_data - Allocates user debug data.
481*ec55c118SRasesh Mody  *
482*ec55c118SRasesh Mody  * @param p_hwfn -		 HW device data
483*ec55c118SRasesh Mody  * @param user_data_ptr - OUT: a pointer to the allocated memory.
484*ec55c118SRasesh Mody  */
485*ec55c118SRasesh Mody enum dbg_status qed_dbg_alloc_user_data(struct ecore_hwfn *p_hwfn,
486*ec55c118SRasesh Mody 					void **user_data_ptr);
487*ec55c118SRasesh Mody 
488*ec55c118SRasesh Mody /**
489*ec55c118SRasesh Mody  * @brief qed_dbg_get_status_str - Returns a string for the specified status.
490*ec55c118SRasesh Mody  *
491*ec55c118SRasesh Mody  * @param status - a debug status code.
492*ec55c118SRasesh Mody  *
493*ec55c118SRasesh Mody  * @return a string for the specified status
494*ec55c118SRasesh Mody  */
495*ec55c118SRasesh Mody const char *qed_dbg_get_status_str(enum dbg_status status);
496*ec55c118SRasesh Mody 
497*ec55c118SRasesh Mody /**
498*ec55c118SRasesh Mody  * @brief qed_get_idle_chk_results_buf_size - Returns the required buffer size
499*ec55c118SRasesh Mody  *	for idle check results (in bytes).
500*ec55c118SRasesh Mody  *
501*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
502*ec55c118SRasesh Mody  * @param dump_buf - idle check dump buffer.
503*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
504*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
505*ec55c118SRasesh Mody  *	results.
506*ec55c118SRasesh Mody  *
507*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
508*ec55c118SRasesh Mody  */
509*ec55c118SRasesh Mody enum dbg_status qed_get_idle_chk_results_buf_size(struct ecore_hwfn *p_hwfn,
510*ec55c118SRasesh Mody 						  u32 *dump_buf,
511*ec55c118SRasesh Mody 						  u32  num_dumped_dwords,
512*ec55c118SRasesh Mody 						  u32 *results_buf_size);
513*ec55c118SRasesh Mody /**
514*ec55c118SRasesh Mody  * @brief qed_print_idle_chk_results - Prints idle check results
515*ec55c118SRasesh Mody  *
516*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
517*ec55c118SRasesh Mody  * @param dump_buf - idle check dump buffer.
518*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
519*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the idle check results.
520*ec55c118SRasesh Mody  * @param num_errors - OUT: number of errors found in idle check.
521*ec55c118SRasesh Mody  * @param num_warnings - OUT: number of warnings found in idle check.
522*ec55c118SRasesh Mody  *
523*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
524*ec55c118SRasesh Mody  */
525*ec55c118SRasesh Mody enum dbg_status qed_print_idle_chk_results(struct ecore_hwfn *p_hwfn,
526*ec55c118SRasesh Mody 					   u32 *dump_buf,
527*ec55c118SRasesh Mody 					   u32 num_dumped_dwords,
528*ec55c118SRasesh Mody 					   char *results_buf,
529*ec55c118SRasesh Mody 					   u32 *num_errors,
530*ec55c118SRasesh Mody 					   u32 *num_warnings);
531*ec55c118SRasesh Mody 
532*ec55c118SRasesh Mody /**
533*ec55c118SRasesh Mody  * @brief qed_dbg_mcp_trace_set_meta_data - Sets the MCP Trace meta data.
534*ec55c118SRasesh Mody  *
535*ec55c118SRasesh Mody  * Needed in case the MCP Trace dump doesn't contain the meta data (e.g. due to
536*ec55c118SRasesh Mody  * no NVRAM access).
537*ec55c118SRasesh Mody  *
538*ec55c118SRasesh Mody  * @param data - pointer to MCP Trace meta data
539*ec55c118SRasesh Mody  * @param size - size of MCP Trace meta data in dwords
540*ec55c118SRasesh Mody  */
541*ec55c118SRasesh Mody void qed_dbg_mcp_trace_set_meta_data(struct ecore_hwfn *p_hwfn,
542*ec55c118SRasesh Mody 				     const u32 *meta_buf);
543*ec55c118SRasesh Mody 
544*ec55c118SRasesh Mody /**
545*ec55c118SRasesh Mody  * @brief qed_get_mcp_trace_results_buf_size - Returns the required buffer size
546*ec55c118SRasesh Mody  *	for MCP Trace results (in bytes).
547*ec55c118SRasesh Mody  *
548*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
549*ec55c118SRasesh Mody  * @param dump_buf - MCP Trace dump buffer.
550*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
551*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
552*ec55c118SRasesh Mody  *	results.
553*ec55c118SRasesh Mody  *
554*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
555*ec55c118SRasesh Mody  */
556*ec55c118SRasesh Mody enum dbg_status qed_get_mcp_trace_results_buf_size(struct ecore_hwfn *p_hwfn,
557*ec55c118SRasesh Mody 						   u32 *dump_buf,
558*ec55c118SRasesh Mody 						   u32 num_dumped_dwords,
559*ec55c118SRasesh Mody 						   u32 *results_buf_size);
560*ec55c118SRasesh Mody 
561*ec55c118SRasesh Mody /**
562*ec55c118SRasesh Mody  * @brief qed_print_mcp_trace_results - Prints MCP Trace results
563*ec55c118SRasesh Mody  *
564*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
565*ec55c118SRasesh Mody  * @param dump_buf - mcp trace dump buffer, starting from the header.
566*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
567*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the mcp trace results.
568*ec55c118SRasesh Mody  *
569*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
570*ec55c118SRasesh Mody  */
571*ec55c118SRasesh Mody enum dbg_status qed_print_mcp_trace_results(struct ecore_hwfn *p_hwfn,
572*ec55c118SRasesh Mody 					    u32 *dump_buf,
573*ec55c118SRasesh Mody 					    u32 num_dumped_dwords,
574*ec55c118SRasesh Mody 					    char *results_buf);
575*ec55c118SRasesh Mody 
576*ec55c118SRasesh Mody /**
577*ec55c118SRasesh Mody  * @brief qed_print_mcp_trace_results_cont - Prints MCP Trace results, and
578*ec55c118SRasesh Mody  * keeps the MCP trace meta data allocated, to support continuous MCP Trace
579*ec55c118SRasesh Mody  * parsing. After the continuous parsing ends, mcp_trace_free_meta_data should
580*ec55c118SRasesh Mody  * be called to free the meta data.
581*ec55c118SRasesh Mody  *
582*ec55c118SRasesh Mody  * @param p_hwfn -	      HW device data
583*ec55c118SRasesh Mody  * @param dump_buf -	      mcp trace dump buffer, starting from the header.
584*ec55c118SRasesh Mody  * @param results_buf -	      buffer for printing the mcp trace results.
585*ec55c118SRasesh Mody  *
586*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
587*ec55c118SRasesh Mody  */
588*ec55c118SRasesh Mody enum dbg_status qed_print_mcp_trace_results_cont(struct ecore_hwfn *p_hwfn,
589*ec55c118SRasesh Mody 						 u32 *dump_buf,
590*ec55c118SRasesh Mody 						 char *results_buf);
591*ec55c118SRasesh Mody 
592*ec55c118SRasesh Mody /**
593*ec55c118SRasesh Mody  * @brief print_mcp_trace_line - Prints MCP Trace results for a single line
594*ec55c118SRasesh Mody  *
595*ec55c118SRasesh Mody  * @param p_hwfn -	      HW device data
596*ec55c118SRasesh Mody  * @param dump_buf -	      mcp trace dump buffer, starting from the header.
597*ec55c118SRasesh Mody  * @param num_dumped_bytes -  number of bytes that were dumped.
598*ec55c118SRasesh Mody  * @param results_buf -	      buffer for printing the mcp trace results.
599*ec55c118SRasesh Mody  *
600*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
601*ec55c118SRasesh Mody  */
602*ec55c118SRasesh Mody enum dbg_status qed_print_mcp_trace_line(struct ecore_hwfn *p_hwfn,
603*ec55c118SRasesh Mody 					 u8 *dump_buf,
604*ec55c118SRasesh Mody 					 u32 num_dumped_bytes,
605*ec55c118SRasesh Mody 					 char *results_buf);
606*ec55c118SRasesh Mody 
607*ec55c118SRasesh Mody /**
608*ec55c118SRasesh Mody  * @brief mcp_trace_free_meta_data - Frees the MCP Trace meta data.
609*ec55c118SRasesh Mody  * Should be called after continuous MCP Trace parsing.
610*ec55c118SRasesh Mody  *
611*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
612*ec55c118SRasesh Mody  */
613*ec55c118SRasesh Mody void qed_mcp_trace_free_meta_data(struct ecore_hwfn *p_hwfn);
614*ec55c118SRasesh Mody 
615*ec55c118SRasesh Mody /**
616*ec55c118SRasesh Mody  * @brief qed_get_reg_fifo_results_buf_size - Returns the required buffer size
617*ec55c118SRasesh Mody  *	for reg_fifo results (in bytes).
618*ec55c118SRasesh Mody  *
619*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
620*ec55c118SRasesh Mody  * @param dump_buf - reg fifo dump buffer.
621*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
622*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
623*ec55c118SRasesh Mody  *	results.
624*ec55c118SRasesh Mody  *
625*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
626*ec55c118SRasesh Mody  */
627*ec55c118SRasesh Mody enum dbg_status qed_get_reg_fifo_results_buf_size(struct ecore_hwfn *p_hwfn,
628*ec55c118SRasesh Mody 						  u32 *dump_buf,
629*ec55c118SRasesh Mody 						  u32 num_dumped_dwords,
630*ec55c118SRasesh Mody 						  u32 *results_buf_size);
631*ec55c118SRasesh Mody 
632*ec55c118SRasesh Mody /**
633*ec55c118SRasesh Mody  * @brief qed_print_reg_fifo_results - Prints reg fifo results
634*ec55c118SRasesh Mody  *
635*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
636*ec55c118SRasesh Mody  * @param dump_buf - reg fifo dump buffer, starting from the header.
637*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
638*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the reg fifo results.
639*ec55c118SRasesh Mody  *
640*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
641*ec55c118SRasesh Mody  */
642*ec55c118SRasesh Mody enum dbg_status qed_print_reg_fifo_results(struct ecore_hwfn *p_hwfn,
643*ec55c118SRasesh Mody 					   u32 *dump_buf,
644*ec55c118SRasesh Mody 					   u32 num_dumped_dwords,
645*ec55c118SRasesh Mody 					   char *results_buf);
646*ec55c118SRasesh Mody 
647*ec55c118SRasesh Mody /**
648*ec55c118SRasesh Mody  * @brief qed_get_igu_fifo_results_buf_size - Returns the required buffer size
649*ec55c118SRasesh Mody  *	for igu_fifo results (in bytes).
650*ec55c118SRasesh Mody  *
651*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
652*ec55c118SRasesh Mody  * @param dump_buf - IGU fifo dump buffer.
653*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
654*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
655*ec55c118SRasesh Mody  *	results.
656*ec55c118SRasesh Mody  *
657*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
658*ec55c118SRasesh Mody  */
659*ec55c118SRasesh Mody enum dbg_status qed_get_igu_fifo_results_buf_size(struct ecore_hwfn *p_hwfn,
660*ec55c118SRasesh Mody 						  u32 *dump_buf,
661*ec55c118SRasesh Mody 						  u32 num_dumped_dwords,
662*ec55c118SRasesh Mody 						  u32 *results_buf_size);
663*ec55c118SRasesh Mody 
664*ec55c118SRasesh Mody /**
665*ec55c118SRasesh Mody  * @brief qed_print_igu_fifo_results - Prints IGU fifo results
666*ec55c118SRasesh Mody  *
667*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
668*ec55c118SRasesh Mody  * @param dump_buf - IGU fifo dump buffer, starting from the header.
669*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
670*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the IGU fifo results.
671*ec55c118SRasesh Mody  *
672*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
673*ec55c118SRasesh Mody  */
674*ec55c118SRasesh Mody enum dbg_status qed_print_igu_fifo_results(struct ecore_hwfn *p_hwfn,
675*ec55c118SRasesh Mody 					   u32 *dump_buf,
676*ec55c118SRasesh Mody 					   u32 num_dumped_dwords,
677*ec55c118SRasesh Mody 					   char *results_buf);
678*ec55c118SRasesh Mody 
679*ec55c118SRasesh Mody /**
680*ec55c118SRasesh Mody  * @brief qed_get_protection_override_results_buf_size - Returns the required
681*ec55c118SRasesh Mody  *	buffer size for protection override results (in bytes).
682*ec55c118SRasesh Mody  *
683*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
684*ec55c118SRasesh Mody  * @param dump_buf - protection override dump buffer.
685*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
686*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
687*ec55c118SRasesh Mody  *	results.
688*ec55c118SRasesh Mody  *
689*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
690*ec55c118SRasesh Mody  */
691*ec55c118SRasesh Mody enum dbg_status
692*ec55c118SRasesh Mody qed_get_protection_override_results_buf_size(struct ecore_hwfn *p_hwfn,
693*ec55c118SRasesh Mody 					     u32 *dump_buf,
694*ec55c118SRasesh Mody 					     u32 num_dumped_dwords,
695*ec55c118SRasesh Mody 					     u32 *results_buf_size);
696*ec55c118SRasesh Mody 
697*ec55c118SRasesh Mody /**
698*ec55c118SRasesh Mody  * @brief qed_print_protection_override_results - Prints protection override
699*ec55c118SRasesh Mody  *	results.
700*ec55c118SRasesh Mody  *
701*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
702*ec55c118SRasesh Mody  * @param dump_buf - protection override dump buffer, starting from the header.
703*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
704*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the reg fifo results.
705*ec55c118SRasesh Mody  *
706*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
707*ec55c118SRasesh Mody  */
708*ec55c118SRasesh Mody enum dbg_status qed_print_protection_override_results(struct ecore_hwfn *p_hwfn,
709*ec55c118SRasesh Mody 						      u32 *dump_buf,
710*ec55c118SRasesh Mody 						      u32 num_dumped_dwords,
711*ec55c118SRasesh Mody 						      char *results_buf);
712*ec55c118SRasesh Mody 
713*ec55c118SRasesh Mody /**
714*ec55c118SRasesh Mody  * @brief qed_get_fw_asserts_results_buf_size - Returns the required buffer size
715*ec55c118SRasesh Mody  *	for FW Asserts results (in bytes).
716*ec55c118SRasesh Mody  *
717*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
718*ec55c118SRasesh Mody  * @param dump_buf - FW Asserts dump buffer.
719*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
720*ec55c118SRasesh Mody  * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed
721*ec55c118SRasesh Mody  *	results.
722*ec55c118SRasesh Mody  *
723*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
724*ec55c118SRasesh Mody  */
725*ec55c118SRasesh Mody enum dbg_status qed_get_fw_asserts_results_buf_size(struct ecore_hwfn *p_hwfn,
726*ec55c118SRasesh Mody 						    u32 *dump_buf,
727*ec55c118SRasesh Mody 						    u32 num_dumped_dwords,
728*ec55c118SRasesh Mody 						    u32 *results_buf_size);
729*ec55c118SRasesh Mody 
730*ec55c118SRasesh Mody /**
731*ec55c118SRasesh Mody  * @brief qed_print_fw_asserts_results - Prints FW Asserts results
732*ec55c118SRasesh Mody  *
733*ec55c118SRasesh Mody  * @param p_hwfn - HW device data
734*ec55c118SRasesh Mody  * @param dump_buf - FW Asserts dump buffer, starting from the header.
735*ec55c118SRasesh Mody  * @param num_dumped_dwords - number of dwords that were dumped.
736*ec55c118SRasesh Mody  * @param results_buf - buffer for printing the FW Asserts results.
737*ec55c118SRasesh Mody  *
738*ec55c118SRasesh Mody  * @return error if the parsing fails, ok otherwise.
739*ec55c118SRasesh Mody  */
740*ec55c118SRasesh Mody enum dbg_status qed_print_fw_asserts_results(struct ecore_hwfn *p_hwfn,
741*ec55c118SRasesh Mody 					     u32 *dump_buf,
742*ec55c118SRasesh Mody 					     u32 num_dumped_dwords,
743*ec55c118SRasesh Mody 					     char *results_buf);
744*ec55c118SRasesh Mody 
745*ec55c118SRasesh Mody /**
746*ec55c118SRasesh Mody  * @brief qed_dbg_parse_attn - Parses and prints attention registers values in
747*ec55c118SRasesh Mody  * the specified results struct.
748*ec55c118SRasesh Mody  *
749*ec55c118SRasesh Mody  * @param p_hwfn -  HW device data
750*ec55c118SRasesh Mody  * @param results - Pointer to the attention read results
751*ec55c118SRasesh Mody  *
752*ec55c118SRasesh Mody  * @return error if one of the following holds:
753*ec55c118SRasesh Mody  *	- the version wasn't set
754*ec55c118SRasesh Mody  * Otherwise, returns ok.
755*ec55c118SRasesh Mody  */
756*ec55c118SRasesh Mody enum dbg_status qed_dbg_parse_attn(struct ecore_hwfn *p_hwfn,
757*ec55c118SRasesh Mody 				   struct dbg_attn_block_result *results);
758*ec55c118SRasesh Mody 
759*ec55c118SRasesh Mody #endif
760