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