]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.h
Performance enhancements to reduce CPU utililization for large number of
[FreeBSD/FreeBSD.git] / sys / dev / qlnx / qlnxe / ecore_dbg_fw_funcs.h
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc. 
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  *
29  */
30
31 #ifndef _DBG_FW_FUNCS_H
32 #define _DBG_FW_FUNCS_H
33 /**************************** Public Functions *******************************/
34
35 /**
36  * @brief ecore_dbg_set_bin_ptr - Sets a pointer to the binary data with debug
37  * arrays.
38  *
39  * @param bin_ptr - a pointer to the binary data with debug arrays.
40  */
41 enum dbg_status ecore_dbg_set_bin_ptr(const u8 * const bin_ptr);
42
43 /**
44  * @brief ecore_dbg_set_app_ver - Sets the version of the calling app.
45  *
46  * The application should call this function with the TOOLS_VERSION
47  * it compiles with. Must be called before all other debug functions.
48  *
49  * @return error if one of the following holds:
50  *      - the specified app version is not supported
51  * Otherwise, returns ok.
52  */
53 enum dbg_status ecore_dbg_set_app_ver(u32 ver);
54
55 /**
56  * @brief ecore_dbg_get_fw_func_ver - Returns the FW func version.
57  *
58  * @return the FW func version.
59  */
60 u32 ecore_dbg_get_fw_func_ver(void);
61
62 /**
63 * @brief ecore_dbg_get_chip_id - Returns the FW func version.
64 *
65 * @param p_hwfn - HW device data
66 *
67 * @return the chip ID.
68 */
69 enum chip_ids ecore_dbg_get_chip_id(struct ecore_hwfn *p_hwfn);
70
71 /**
72  * @brief ecore_dbg_bus_reset - Resets the Debug block.
73  *
74  * After reset:
75  * - The last recording is erased.
76  * - Recording is directed to the internal buffer.
77  * - Wrap-around recording is selected.
78  * - All HW blocks are disabled.
79  * - All Storms are disabled and all SEM filters are cleared.
80  *
81  * @param p_hwfn -                  HW device data
82  * @param p_ptt -                   Ptt window used for writing the registers.
83  * @param one_shot_en -     Enable/Disable one-shot recording. If disabled,
84  *                          wrap-around recording is used instead.
85  * @param force_hw_dwords - If set to 0, no. of HW/Storm dwords per cycle is
86  *                          chosen automatically based on the enabled inputs.
87  *                          Otherwise, no. of HW dwords per cycle is forced to
88  *                          the specified value. Valid values: 0/2/4/8.
89  * @param unify_inputs -    If true, all recorded data is associated with a
90  *                          single input, as if all data was received from the
91  *                          same block. Otherwise, each data unit is associated
92  *                          with its original input.
93  * @param grc_input_en -    Enable/Disable recording GRC input. If enabled, the
94  *                          GRC input is recorded to the lsb dword of a cycle.
95  *
96  * @return error if one of the following holds:
97  *      - the version wasn't set
98  *      - force_hw_dwords is invalid.
99  * Otherwise, returns ok.
100  */
101 enum dbg_status ecore_dbg_bus_reset(struct ecore_hwfn *p_hwfn,
102                                                                         struct ecore_ptt *p_ptt,
103                                                                         bool one_shot_en,
104                                                                         u8 force_hw_dwords,
105                                                                         bool unify_inputs,
106                                                                         bool grc_input_en);
107
108 /**
109  * @brief ecore_dbg_bus_set_pci_output - Directs debug output to a PCI buffer.
110  *
111  * @param p_hwfn -              HW device data
112  * @param p_ptt -               Ptt window used for writing the registers.
113  * @param buf_size_kb - Size of PCI buffer to allocate (in KB). Must be aligned
114  *                      to PCI request size.
115  *
116  * @return error if one of the following holds:
117  *      - the Debug block wasn't reset since last recording
118  *      - the version wasn't set
119  *      - the output was already set
120  *      - the PCI buffer size is not aligned to PCI packet size
121  *      - the PCI buffer allocation failed
122  * Otherwise, returns ok.
123  */
124 enum dbg_status ecore_dbg_bus_set_pci_output(struct ecore_hwfn *p_hwfn,
125                                                                                          struct ecore_ptt *p_ptt,
126                                                                                          u16 buf_size_kb);
127
128 /**
129  * @brief ecore_dbg_bus_set_nw_output - Directs debug output to the network.
130  *
131  * @param p_hwfn -                      HW device data
132  * @param p_ptt -                       Ptt window used for writing the registers.
133  * @param port_id -             Port ID to transmit the debug data on
134  * @param dest_addr_lo32 -      Destination MAC address (for Eth header)
135  * @param dest_addr_hi16
136  * @param data_limit_size_kb -  Data limit size in KB (valid only for one-shot)
137  *                              If set to 0, data limit won't be configured. 
138  * @param send_to_other_engine -If true:
139  *                              1) The NW output will be sent to the DBG block
140  *                                 of the other engine.
141  *                              2) port_id argument is ignored.
142  *                              3) rcv_from_other_engine should be set to false
143  *                                 The other engine DBG block should call this
144  *                                 function with rcv_from_other_engine set to
145  *                                 true.
146  * @param rcv_from_other_engine-If true:
147  *                              1) the DBG block receives the NW output sent
148  *                                 from the other engine DBG block, and sends
149  *                                 it to a NW port in the current engine
150  *                                 (according to port_id).
151  *                              2) The src/dest addresses and eth_type
152  *                                 arguments are ignored.
153  *                              3) send_to_other_engine should be set to false.
154  *                                 The other engine DBG block should call this
155  *                                 function with send_to_other_engine set to
156  *                                 true.
157  *
158  * @return error if one of the following holds:
159  *      - the Debug block wasn't reset since last recording
160  *      - the version wasn't set
161  *      - the output was already set
162  * Otherwise, returns ok.
163  */
164 enum dbg_status ecore_dbg_bus_set_nw_output(struct ecore_hwfn *p_hwfn,
165                                                                                         struct ecore_ptt *p_ptt,
166                                                                                         u8 port_id,
167                                                                                         u32 dest_addr_lo32,
168                                                                                         u16 dest_addr_hi16,
169                                                                                         u16 data_limit_size_kb,
170                                                                                         bool send_to_other_engine,
171                                                                                         bool rcv_from_other_engine);
172
173 /**
174  * @brief ecore_dbg_bus_enable_block - Enables recording of the specified block
175  *
176  * Each recording cycle contains 4 "units". If the recorded HW data requires up
177  * to 4 dwords per cycle, each unit is one dword (32 bits). Otherwise, each
178  * unit is 2 dwords (64 bits).
179  *
180  * @param p_hwfn -              HW device data
181  * @param block -       block to be enabled.
182  * @param line_num -    debug line number to select.
183  * @param cycle_en -    4-bit value. If bit i is set, unit i is enabled.
184  * @param right_shift - number of units to  right the debug data (0-3).
185  * @param force_valid - 4-bit value. If bit i is set, unit i is forced valid.
186  * @param force_frame - 4-bit value. If bit i is set, the frame bit of unit i
187  *                      is forced.
188  *
189  * @return error if one of the following holds:
190  *      - the Debug block wasn't reset since last recording
191  *      - the version wasn't set
192  *      - block is not valid
193  *      - block was already enabled
194  *      - cycle_en, force_valid or force_frame are wider than 4 bits
195  *      - right_shift is larger than 3
196  *      - cycle unit 0 is enabled, but GRC or timestamp were also enabled.
197  *      - Too many inputs were enabled.
198  * Otherwise, returns ok.
199  */
200 enum dbg_status ecore_dbg_bus_enable_block(struct ecore_hwfn *p_hwfn,
201                                            enum block_id block,
202                                            u8 line_num,
203                                            u8 cycle_en,
204                                            u8 right_shift,
205                                            u8 force_valid,
206                                            u8 force_frame);
207
208 /**
209  * @brief ecore_dbg_bus_enable_storm - Enables recording of the specified Storm
210  *
211  * @param p_hwfn -              HW device data
212  * @param storm -       Storm to be enabled.
213  * @param storm_mode-   Storm mode
214  *
215  * @return error if one of the following holds:
216  *      - the Debug block wasn't reset since last recording
217  *      - the version wasn't set
218  *      - the specified storm or mode is invalid
219  *      - Storm was already enabled
220  *      - only HW data can be recorded
221  *      - Too many inputs were enabled.
222  * Otherwise, returns ok.
223  */
224 enum dbg_status ecore_dbg_bus_enable_storm(struct ecore_hwfn *p_hwfn,
225                                                                                    enum dbg_storms storm,
226                                                                                    enum dbg_bus_storm_modes storm_mode);
227
228 /**
229  * @brief ecore_dbg_bus_enable_timestamp - Enables timestamp recording.
230  *
231  * When enabled, the timestamp input is always recorded to the lsb dword of
232  * a cycle, with HW ID 0.
233  *
234  * @param p_hwfn -           HW device data
235  * @param p_ptt -            Ptt window used for writing the registers.
236  * @param valid_en - 3-bit value. The Timestamp will be recorded in a cycle if
237  *                   bit i is set and unit i+1 is valid.
238  * @param frame_en - 3-bit value. The Timestamp will be recorded in a cycle if
239  *                   bit i is set and unit i+1 has frame bit set.
240  * @param tick_len - timestamp tick length in cycles, minus 1. A value of 0
241  *                   means one cycle.
242  *
243  * @return error if one of the following holds:
244  *      - the Debug block wasn't reset since last recording
245  *      - the version wasn't set
246  *      - valid_en or frame_en are wider than 4 bits
247  *      - Both timestamp and GRC are enabled.
248  * Otherwise, returns ok.
249  */
250 enum dbg_status ecore_dbg_bus_enable_timestamp(struct ecore_hwfn *p_hwfn,
251                                                                                            struct ecore_ptt *p_ptt,
252                                                                                            u8 valid_en,
253                                                                                            u8 frame_en,
254                                                                                            u32 tick_len);
255
256 /**
257  * @brief ecore_dbg_bus_add_eid_range_sem_filter- Add Event ID range SEM filter
258  *
259  * @param p_hwfn -     HW device data
260  * @param storm -   Storm to be filtered.
261  * @param min_eid - minimal Event ID to filter on.
262  * @param max_eid - maximal Event ID to filter on.
263  *
264  * @return error if one of the following holds:
265  *      - the specified Storm is invalid
266  *      - the specified Storm wasn't enabled
267  *      - the EID range is not valid
268  * Otherwise, returns ok.
269  */
270 enum dbg_status ecore_dbg_bus_add_eid_range_sem_filter(struct ecore_hwfn *p_hwfn,
271                                                                                                            enum dbg_storms storm,
272                                                                                                            u8 min_eid,
273                                                                                                            u8 max_eid);
274
275 /**
276  * @brief ecore_dbg_bus_add_eid_mask_sem_filter - Add Event ID mask SEM filter
277  *
278  * @param p_hwfn -      HW device data
279  * @param storm -    Storm to be filtered.
280  * @param eid_val -  Event ID value.
281  * @param eid_mask - Event ID mask. 0's in the mask = don't care bits.
282  *
283  * @return error if one of the following holds:
284  *      - the specified Storm is invalid
285  *      - the specified Storm wasn't enabled
286  * Otherwise, returns ok.
287  */
288 enum dbg_status ecore_dbg_bus_add_eid_mask_sem_filter(struct ecore_hwfn *p_hwfn,
289                                                                                                           enum dbg_storms storm,
290                                                                                                           u8 eid_val,
291                                                                                                           u8 eid_mask);
292
293 /**
294  * @brief ecore_dbg_bus_add_cid_sem_filter - Adds a CID SEM filter.
295  *
296  * @param p_hwfn -   HW device data
297  * @param storm - Storm to be filtered.
298  * @param cid -   CID to filter on.
299  *
300  * @return error if one of the following holds:
301  *      - the specified Storm is invalid
302  *      - the specified Storm wasn't enabled
303  * Otherwise, returns ok.
304  */
305 enum dbg_status ecore_dbg_bus_add_cid_sem_filter(struct ecore_hwfn *p_hwfn,
306                                                                                                  enum dbg_storms storm,
307                                                                                                  u32 cid);
308
309 /**
310  * @brief ecore_dbg_bus_enable_filter - Enables the recording filter.
311  *
312  * A filter contains up to 4 constraints. The data is "filtered in" when the
313  * added constraints hold.
314  *
315  * @param p_hwfn -                HW device data
316  * @param p_ptt -                 Ptt window used for writing the registers.
317  * @param block -         block to filter on.
318  * @param const_msg_len - Constant message length (in cycles) to be used for
319  *                        message-based filter constraints. If set to 0,
320  *                        message length is based only on frame bit received
321  *                        from HW (no constant message length).
322  *
323  * @return error if one of the following holds:
324  *      - the Debug block wasn't reset since last recording
325  *      - the version wasn't set
326  *      - the filter was already enabled
327  *      - block is not valid or not enabled
328  *      - more than 4 dwords are recorded per-cycle (forbids filters)
329  * Otherwise, returns ok.
330  */
331 enum dbg_status ecore_dbg_bus_enable_filter(struct ecore_hwfn *p_hwfn,
332                                                                                         struct ecore_ptt *p_ptt,
333                                                                                         enum block_id block,
334                                                                                         u8 const_msg_len);
335
336 /**
337  * @brief ecore_dbg_bus_enable_trigger - Enables the recording trigger.
338  *
339  * A trigger contains up to 3 states, where each state contains up to
340  * 4 constraints. After the constraints of a state hold for a specified number
341  * of times, the DBG block moves to the next state. If there's no next state,
342  * the DBG block triggers.
343  *
344  * @param p_hwfn -                      HW device data
345  * @param p_ptt -                       Ptt window used for writing the registers.
346  * @param rec_pre_trigger -     if true, recording starts before the trigger.
347  *                              if false, recording starts at the trigger.
348  * @param pre_chunks -          max number of chunks to record before the
349  *                              trigger (1-47). If set to 0, recording starts
350  *                              from time 0. Ignored if rec_pre_trigger is
351  *                              false.
352  * @param rec_post_trigger -    if true, recording ends after the trigger.
353  *                              if false, recording ends at the trigger.
354  * @param post_cycles -         max number of cycles to record after the
355  *                              trigger (0x1-0xffffffff). If set to 0,
356  *                              recording ends only when stopped by the user.
357  *                              Ignored if rec_post_trigger is false.
358  * @param filter_pre_trigger -  if true, data is filtered before the trigger.
359  *                              Ignored if the filter wasn't enabled.
360  * @param filter_post_trigger - if true, data is filtered after the trigger.
361  *                              Ignored if the filter wasn't enabled.
362  *
363  * @return error if one of the following holds:
364  *      - the Debug block wasn't reset since last recording
365  *      - the version wasn't set
366  *      - the trigger was already enabled
367  *      - more than 4 dwords are recorded per-cycle (forbids triggers)
368  *      - pre_chunks is not in the range 0-47. 
369  * Otherwise, returns ok.
370  */
371 enum dbg_status ecore_dbg_bus_enable_trigger(struct ecore_hwfn *p_hwfn,
372                                                                                          struct ecore_ptt *p_ptt,
373                                                                                          bool rec_pre_trigger,
374                                                                                          u8 pre_chunks,
375                                                                                          bool rec_post_trigger,
376                                                                                          u32 post_cycles,
377                                                                                          bool filter_pre_trigger,
378                                                                                          bool filter_post_trigger);
379
380 /**
381  * @brief ecore_dbg_bus_add_trigger_state - Adds a trigger state.
382  *
383  * Up to 3 trigger states can be added, where each state contains up to
384  * 4 constraints. After the constraints of a state hold for the specified
385  * number of times, the DBG block moves to the next state. If there's no next
386  * state, the DBG block triggers.
387  *
388  * @param p_hwfn -                HW device data
389  * @param p_ptt -                 Ptt window used for writing the registers.
390  * @param block -         block to trigger on.
391  * @param const_msg_len - Constant message length (in cycles) to be used for
392  *                        message-based filter constraints. If set to 0,
393  *                        message length is based only on frame bit received
394  *                        from HW (no constant message length).
395  * @param count_to_next - The number of times the constraints of the state
396  *                        should hold before moving to the next state. Must be
397  *                        non-zero.
398  *
399  * @return error if one of the following holds:
400  *      - The trigger wasn't enabled.
401  *      - more than 3 trigger states were added
402  *      - block is not valid or not enabled
403  *      - count_to_next is 0
404  * Otherwise, returns ok.
405  */
406 enum dbg_status ecore_dbg_bus_add_trigger_state(struct ecore_hwfn *p_hwfn,
407                                                                                                 struct ecore_ptt *p_ptt,
408                                                                                                 enum block_id block,
409                                                                                                 u8 const_msg_len,
410                                                                                                 u16 count_to_next);
411
412 /**
413  * @brief ecore_dbg_bus_add_constraint - Adds a filter/trigger constraint.
414  *
415  * The constraint is added to a filter or trigger state, which ever was added
416  * last. The filter/trigger happens if both of the following hold:
417  * 1. All mandatory constraints are true.
418  * 2. At least one optional (non-mandatory) constraints is true.
419  *
420  * @param p_hwfn -                        HW device data
421  * @param p_ptt -                         Ptt window used for writing the registers.
422  * @param op -                    constraint operation
423  * @param data -                  32-bit data to compare with the recorded
424  *                                data.
425  * @param data_mask -             32-bit mask for data comparison. If mask bit
426  *                                i is 1, data bit i is compared, otherwise
427  *                                it's ignored.
428  *                                For eq/ne operations: any mask can be used.
429  *                                For other operations: the mask must be
430  *                                non-zero, and the 1's in the mask must be
431  *                                continuous.
432  * @param compare_frame -         indicates if the frame bit should be
433  *                                compared. Must be false for all operations
434  *                                other than eq/ne.
435  * @param frame_bit -             frame bit to compare with the recorded data
436  *                                (0/1). ignored if compare_frame is false.
437  * @param cycle_offset -          offset in cycles from the beginning of the
438  *                                message, where cycle = 4 dwords.
439  * @param dword_offset_in_cycle - offset in dwords from the beginning of the
440  *                                cycle (0-3).
441  * @param is_mandatory -          indicates if this constraint is mandatory
442  *                                (true) or optional (false). The data is
443  *                                filtered-in if all mandatory constraints hold
444  *                                AND at least one optional constraint (if
445  *                                added) holds.
446  *
447  * @return error if one of the following holds:
448  *      - a filter or trigger state weren't enabled
449  *      - all 4 filter constraints were added already
450  *      - the op string is invalid
451  *      - the data mask is invalid.
452  *      - frame bit is not 0/1.
453  *      - cycle_offset and dword_offset are not in the range 0-3.
454  *      - compare_frame is true and operation is not eq/ne.
455  * Otherwise, returns ok.
456  */
457 enum dbg_status ecore_dbg_bus_add_constraint(struct ecore_hwfn *p_hwfn,
458                                                                                          struct ecore_ptt *p_ptt,
459                                                                                          enum dbg_bus_constraint_ops constraint_op,
460                                                                                          u32 data,
461                                                                                          u32 data_mask,
462                                                                                          bool compare_frame,
463                                                                                          u8 frame_bit,
464                                                                                          u8 cycle_offset,
465                                                                                          u8 dword_offset_in_cycle,
466                                                                                          bool is_mandatory);
467
468 /**
469  * @brief ecore_dbg_bus_start - Starts the recording.
470  *
471  * @param p_hwfn - HW device data
472  * @param p_ptt - Ptt window used for writing the registers.
473  *
474  * @return error if one of the following holds:
475  *      - the Debug block wasn't reset since last recording
476  *      - the version wasn't set
477  * Otherwise, returns ok.
478  */
479 enum dbg_status ecore_dbg_bus_start(struct ecore_hwfn *p_hwfn,
480                                                                         struct ecore_ptt *p_ptt);
481
482 /**
483  * @brief ecore_dbg_bus_stop - Stops the recording and flushes the internal
484  * buffer.
485  *
486  * @param p_hwfn - HW device data
487  * @param p_ptt - Ptt window used for writing the registers.
488  *
489  * @return error if a recording is not in progress, ok otherwise.
490  */
491 enum dbg_status ecore_dbg_bus_stop(struct ecore_hwfn *p_hwfn,
492                                                                    struct ecore_ptt *p_ptt);
493
494 /**
495  * @brief ecore_dbg_bus_get_dump_buf_size - Returns the required buffer size
496  * for Debug Bus recording.
497  *
498  * @param p_hwfn -      HW device data
499  * @param p_ptt -            Ptt window used for writing the registers.
500  * @param buf_size - OUT: the required size (in dwords) of the buffer for
501  *                   dumping the recorded Debug Bus data. If recording to the
502  *                   internal buffer, the size of the internal buffer is
503  *                   returned. If recording to PCI, the size of the PCI buffer
504  *                   is returned. Otherwise, 0 is returned.
505  *
506  * @return error if one of the following holds:
507  *      - the version wasn't set
508  * Otherwise, returns ok.
509  */
510 enum dbg_status ecore_dbg_bus_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
511                                                                                                 struct ecore_ptt *p_ptt,
512                                                                                                 u32 *buf_size);
513
514 /**
515  * @brief ecore_dbg_bus_dump - Dumps the recorded Debug Bus data into the
516  * specified buffer.
517  *
518  * The dumped data starts with a header. If recording to NW, only a header is
519  * dumped. The dumped size is assigned to num_dumped_dwords.
520  *
521  * @param p_hwfn -                      HW device data
522  * @param p_ptt -                       Ptt window used for writing the registers.
523  * @param dump_buf -            Pointer to copy the recorded data into.
524  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
525  * @param num_dumped_dwords -   OUT: number of dumped dwords.
526  *
527  * @return error if one of the following holds:
528  *      - a recording wasn't started/stopped
529  *      - the specified dump buffer is too small
530  * Otherwise, returns ok.
531  */
532 enum dbg_status ecore_dbg_bus_dump(struct ecore_hwfn *p_hwfn,
533                                                                    struct ecore_ptt *p_ptt,
534                                                                    u32 *dump_buf,
535                                                                    u32 buf_size_in_dwords,
536                                                                    u32 *num_dumped_dwords);
537
538 /**
539  * @brief ecore_dbg_grc_config - Sets the value of a GRC parameter.
540  *
541  * @param p_hwfn -              HW device data
542  * @param grc_param -   GRC parameter
543  * @param val -         Value to set.
544
545  * @return error if one of the following holds:
546  *      - the version wasn't set
547  *      - grc_param is invalid
548  *      - val is outside the allowed boundaries
549  */
550 enum dbg_status ecore_dbg_grc_config(struct ecore_hwfn *p_hwfn,
551                                                                          enum dbg_grc_params grc_param,
552                                                                          u32 val);
553
554 /**
555 * @brief ecore_dbg_grc_set_params_default - Reverts all GRC parameters to their
556 * default value.
557 *
558 * @param p_hwfn - HW device data
559 */
560 void ecore_dbg_grc_set_params_default(struct ecore_hwfn *p_hwfn);
561
562 /**
563  * @brief ecore_dbg_grc_get_dump_buf_size - Returns the required buffer size
564  * for GRC Dump.
565  *
566  * @param p_hwfn -      HW device data
567  * @param p_ptt -            Ptt window used for writing the registers.
568  * @param buf_size - OUT: required buffer size (in dwords) for GRC Dump data.
569  *
570  * @return error if one of the following holds:
571  *      - the version wasn't set
572  * Otherwise, returns ok.
573  */
574 enum dbg_status ecore_dbg_grc_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
575                                                                                                 struct ecore_ptt *p_ptt,
576                                                                                                 u32 *buf_size);
577
578 /**
579  * @brief ecore_dbg_grc_dump - Dumps GRC data into the specified buffer.
580  *
581  * @param p_hwfn -                      HW device data
582  * @param p_ptt -                       Ptt window used for writing the registers.
583  * @param dump_buf -            Pointer to write the collected GRC data into.
584  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
585  * @param num_dumped_dwords -   OUT: number of dumped dwords.
586  *
587  * @return error if one of the following holds:
588  *      - the version wasn't set
589  *      - the specified dump buffer is too small
590  * Otherwise, returns ok.
591  */
592 enum dbg_status ecore_dbg_grc_dump(struct ecore_hwfn *p_hwfn,
593                                                                    struct ecore_ptt *p_ptt,
594                                                                    u32 *dump_buf,
595                                                                    u32 buf_size_in_dwords,
596                                                                    u32 *num_dumped_dwords);
597
598 /**
599  * @brief ecore_dbg_idle_chk_get_dump_buf_size - Returns the required buffer
600  * size for idle check results.
601  *
602  * @param p_hwfn -      HW device data
603  * @param p_ptt -      Ptt window used for writing the registers.
604  * @param buf_size - OUT: required buffer size (in dwords) for idle check data.
605  *
606  * @return error if one of the following holds:
607  *      - the version wasn't set
608  * Otherwise, returns ok.
609  */
610 enum dbg_status ecore_dbg_idle_chk_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
611                                                                                                          struct ecore_ptt *p_ptt,
612                                                                                                          u32 *buf_size);
613
614 /**
615  * @brief ecore_dbg_idle_chk_dump - Performs idle check and writes the results
616  * into the specified buffer.
617  *
618  * @param p_hwfn -                      HW device data
619  * @param p_ptt -                       Ptt window used for writing the registers.
620  * @param dump_buf -            Pointer to write the idle check data into.
621  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
622  * @param num_dumped_dwords -   OUT: number of dumped dwords.
623  *
624  * @return error if one of the following holds:
625  *      - the version wasn't set
626  *      - the specified buffer is too small
627  * Otherwise, returns ok.
628  */
629 enum dbg_status ecore_dbg_idle_chk_dump(struct ecore_hwfn *p_hwfn,
630                                                                                 struct ecore_ptt *p_ptt,
631                                                                                 u32 *dump_buf,
632                                                                                 u32 buf_size_in_dwords,
633                                                                                 u32 *num_dumped_dwords);
634
635 /**
636  * @brief ecore_dbg_mcp_trace_get_dump_buf_size - Returns the required buffer
637  * size for mcp trace results.
638  *
639  * @param p_hwfn -           HW device data
640  * @param p_ptt -            Ptt window used for writing the registers.
641  * @param buf_size - OUT: required buffer size (in dwords) for mcp trace data.
642  *
643  * @return error if one of the following holds:
644  *      - the version wasn't set
645  *      - the trace data in MCP scratchpad contain an invalid signature
646  *      - the bundle ID in NVRAM is invalid
647  *      - the trace meta data cannot be found (in NVRAM or image file)
648  * Otherwise, returns ok.
649  */
650 enum dbg_status ecore_dbg_mcp_trace_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
651                                                                                                           struct ecore_ptt *p_ptt,
652                                                                                                           u32 *buf_size);
653
654 /**
655  * @brief ecore_dbg_mcp_trace_dump - Performs mcp trace and writes the results
656  * into the specified buffer.
657  *
658  * @param p_hwfn -                      HW device data
659  * @param p_ptt -                       Ptt window used for writing the registers.
660  * @param dump_buf -            Pointer to write the mcp trace data into.
661  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
662  * @param num_dumped_dwords -   OUT: number of dumped dwords.
663  *
664  * @return error if one of the following holds:
665  *      - the version wasn't set
666  *      - the specified buffer is too small
667  *      - the trace data in MCP scratchpad contain an invalid signature
668  *      - the bundle ID in NVRAM is invalid
669  *      - the trace meta data cannot be found (in NVRAM or image file)
670  *      - the trace meta data cannot be read (from NVRAM or image file)
671  * Otherwise, returns ok.
672  */
673 enum dbg_status ecore_dbg_mcp_trace_dump(struct ecore_hwfn *p_hwfn,
674                                                                                  struct ecore_ptt *p_ptt,
675                                                                                  u32 *dump_buf,
676                                                                                  u32 buf_size_in_dwords,
677                                                                                  u32 *num_dumped_dwords);
678
679 /**
680  * @brief ecore_dbg_reg_fifo_get_dump_buf_size - Returns the required buffer
681  * size for grc trace fifo results.
682  *
683  * @param p_hwfn -      HW device data
684  * @param p_ptt -      Ptt window used for writing the registers.
685  * @param buf_size - OUT: required buffer size (in dwords) for reg fifo data.
686  *
687  * @return error if one of the following holds:
688  *      - the version wasn't set
689  * Otherwise, returns ok.
690  */
691 enum dbg_status ecore_dbg_reg_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
692                                                                                                          struct ecore_ptt *p_ptt,
693                                                                                                          u32 *buf_size);
694
695 /**
696  * @brief ecore_dbg_reg_fifo_dump - Reads the reg fifo and writes the results
697  * into the specified buffer.
698  *
699  * @param p_hwfn -                      HW device data
700  * @param p_ptt -                       Ptt window used for writing the registers.
701  * @param dump_buf -            Pointer to write the reg fifo data into.
702  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
703  * @param num_dumped_dwords -   OUT: number of dumped dwords.
704  *
705  * @return error if one of the following holds:
706  *      - the version wasn't set
707  *      - the specified buffer is too small
708  *      - DMAE transaction failed
709  * Otherwise, returns ok.
710  */
711 enum dbg_status ecore_dbg_reg_fifo_dump(struct ecore_hwfn *p_hwfn,
712                                                                                 struct ecore_ptt *p_ptt,
713                                                                                 u32 *dump_buf,
714                                                                                 u32 buf_size_in_dwords,
715                                                                                 u32 *num_dumped_dwords);
716
717 /**
718 * @brief ecore_dbg_igu_fifo_get_dump_buf_size - Returns the required buffer
719 * size for the IGU fifo results.
720 *
721 * @param p_hwfn -      HW device data
722 * @param p_ptt -      Ptt window used for writing the registers.
723 * @param buf_size - OUT: required buffer size (in dwords) for IGU fifo data.
724 *
725 * @return error if one of the following holds:
726 *       - the version wasn't set
727 * Otherwise, returns ok.
728 */
729 enum dbg_status ecore_dbg_igu_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
730                                                                                                          struct ecore_ptt *p_ptt,
731                                                                                                          u32 *buf_size);
732
733 /**
734 * @brief ecore_dbg_igu_fifo_dump - Reads the IGU fifo and writes the results
735 * into the specified buffer.
736 *
737 * @param p_hwfn -                       HW device data
738 * @param p_ptt -                        Ptt window used for writing the registers.
739 * @param dump_buf -             Pointer to write the IGU fifo data into.
740 * @param buf_size_in_dwords -   Size of the specified buffer in dwords.
741 * @param num_dumped_dwords -    OUT: number of dumped dwords.
742 *
743 * @return error if one of the following holds:
744 *       - the version wasn't set
745 *       - the specified buffer is too small
746 *       - DMAE transaction failed
747 * Otherwise, returns ok.
748 */
749 enum dbg_status ecore_dbg_igu_fifo_dump(struct ecore_hwfn *p_hwfn,
750                                                                                 struct ecore_ptt *p_ptt,
751                                                                                 u32 *dump_buf,
752                                                                                 u32 buf_size_in_dwords,
753                                                                                 u32 *num_dumped_dwords);
754
755 /**
756  * @brief ecore_dbg_protection_override_get_dump_buf_size - Return the required
757  * buffer size for protection override window results.
758  *
759  * @param p_hwfn -      HW device data
760  * @param p_ptt -      Ptt window used for writing the registers.
761  * @param buf_size - OUT: required buffer size (in dwords) for protection
762  *                   override data.
763  *
764  * @return error if one of the following holds:
765  *      - the version wasn't set
766  * Otherwise, returns ok.
767  */
768 enum dbg_status ecore_dbg_protection_override_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
769                                                                                                                                 struct ecore_ptt *p_ptt,
770                                                                                                                                 u32 *buf_size);
771 /**
772  * @brief ecore_dbg_protection_override_dump - Reads protection override window
773  * entries and writes the results into the specified buffer.
774  *
775  * @param p_hwfn -                      HW device data
776  * @param p_ptt -                       Ptt window used for writing the registers.
777  * @param dump_buf -            Pointer to write the protection override data
778  *                              into.
779  * @param buf_size_in_dwords -  Size of the specified buffer in dwords.
780  * @param num_dumped_dwords -   OUT: number of dumped dwords.
781  *
782  * @return error if one of the following holds:
783  *      - the version wasn't set
784  *      - the specified buffer is too small
785  *      - DMAE transaction failed
786  * Otherwise, returns ok.
787  */
788 enum dbg_status ecore_dbg_protection_override_dump(struct ecore_hwfn *p_hwfn,
789                                                                                                    struct ecore_ptt *p_ptt,
790                                                                                                    u32 *dump_buf,
791                                                                                                    u32 buf_size_in_dwords,
792                                                                                                    u32 *num_dumped_dwords);
793
794 /**
795 * @brief ecore_dbg_fw_asserts_get_dump_buf_size - Returns the required buffer
796 * size for FW Asserts results.
797 *
798 * @param p_hwfn -           HW device data
799 * @param p_ptt -            Ptt window used for writing the registers.
800 * @param buf_size - OUT: required buffer size (in dwords) for FW Asserts data.
801 *
802 * @return error if one of the following holds:
803 *       - the version wasn't set
804 * Otherwise, returns ok.
805 */
806 enum dbg_status ecore_dbg_fw_asserts_get_dump_buf_size(struct ecore_hwfn *p_hwfn,
807                                                                                                            struct ecore_ptt *p_ptt,
808                                                                                                            u32 *buf_size);
809
810 /**
811 * @brief ecore_dbg_fw_asserts_dump - Reads the FW Asserts and writes the
812 * results into the specified buffer.
813 *
814 * @param p_hwfn -                       HW device data
815 * @param p_ptt -                        Ptt window used for writing the registers.
816 * @param dump_buf -             Pointer to write the FW Asserts data into.
817 * @param buf_size_in_dwords -   Size of the specified buffer in dwords.
818 * @param num_dumped_dwords -    OUT: number of dumped dwords.
819 *
820 * @return error if one of the following holds:
821 *       - the version wasn't set
822 *       - the specified buffer is too small
823 * Otherwise, returns ok.
824 */
825 enum dbg_status ecore_dbg_fw_asserts_dump(struct ecore_hwfn *p_hwfn,
826                                                                                   struct ecore_ptt *p_ptt,
827                                                                                   u32 *dump_buf,
828                                                                                   u32 buf_size_in_dwords,
829                                                                                   u32 *num_dumped_dwords);
830
831 /**
832 * @brief ecore_dbg_read_attn - Reads the attention registers of the specified
833 * block and type, and writes the results into the specified buffer.
834 *
835 * @param p_hwfn -               HW device data
836 * @param p_ptt -                Ptt window used for writing the registers.
837 * @param block -        Block ID.
838 * @param attn_type -    Attention type.
839 * @param clear_status - Indicates if the attention status should be cleared.
840 * @param results -      OUT: Pointer to write the read results into
841 *
842 * @return error if one of the following holds:
843 *       - the version wasn't set
844 * Otherwise, returns ok.
845 */
846 enum dbg_status ecore_dbg_read_attn(struct ecore_hwfn *p_hwfn,
847                                                                         struct ecore_ptt *p_ptt,
848                                                                         enum block_id block,
849                                                                         enum dbg_attn_type attn_type,
850                                                                         bool clear_status,
851                                                                         struct dbg_attn_block_result *results);
852                                                                         
853 /**
854 * @brief ecore_dbg_print_attn - Prints attention registers values in the
855 * specified results struct.
856 *
857 * @param p_hwfn -     HW device data
858 * @param results - Pointer to the attention read results
859 *
860 * @return error if one of the following holds:
861 *       - the version wasn't set
862 * Otherwise, returns ok.
863 */
864 enum dbg_status ecore_dbg_print_attn(struct ecore_hwfn *p_hwfn,
865                                                                          struct dbg_attn_block_result *results);
866
867 /**
868 * @brief ecore_is_block_in_reset - Returns true if the specified block is in
869 * reset, false otherwise.
870 *
871 * @param p_hwfn   - HW device data
872 * @param p_ptt   - Ptt window used for writing the registers.
873 * @param block - Block ID.
874 *
875 * @return true if the specified block is in reset, false otherwise.
876 */
877 bool ecore_is_block_in_reset(struct ecore_hwfn *p_hwfn,
878                                                          struct ecore_ptt *p_ptt,
879                                                          enum block_id block);
880
881
882 #endif