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