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