xref: /freebsd/sys/dev/cxgbe/cudbg/cudbg.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*-
2  * Copyright (c) 2017 Chelsio Communications, 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  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  */
27 
28 /*
29  * Chelsio Unified Debug Interface header file.
30  * Version 1.1
31  */
32 #ifndef _CUDBG_IF_H_
33 #define _CUDBG_IF_H_
34 
35 #ifdef __GNUC__
36 #define ATTRIBUTE_UNUSED __attribute__ ((unused))
37 #else
38 #define ATTRIBUTE_UNUSED
39 #endif
40 
41 #if defined(CONFIG_CUDBG_DEBUG)
42 #define cudbg_debug(pdbg_init, format,  ...) do {\
43 	pdbg_init->print(format, ##__VA_ARGS__); \
44 } while (0)
45 #else
46 #define cudbg_debug(pdbg_init, format,  ...) do { } while (0)
47 #endif
48 
49 #define OUT
50 #define IN
51 #define INOUT
52 
53 /* Error codes */
54 
55 #define CUDBG_STATUS_SUCCESS		     0
56 #define CUDBG_STATUS_NOSPACE		    -2
57 #define CUDBG_STATUS_FLASH_WRITE_FAIL	    -3
58 #define CUDBG_STATUS_FLASH_READ_FAIL	    -4
59 #define CUDBG_STATUS_UNDEFINED_OUT_BUF	    -5
60 #define CUDBG_STATUS_UNDEFINED_CBFN	    -6
61 #define CUDBG_STATUS_UNDEFINED_PRINTF_CBFN  -7
62 #define CUDBG_STATUS_ADAP_INVALID	    -8
63 #define CUDBG_STATUS_FLASH_EMPTY	    -9
64 #define CUDBG_STATUS_NO_ADAPTER		    -10
65 #define CUDBG_STATUS_NO_SIGNATURE	    -11
66 #define CUDBG_STATUS_MULTIPLE_REG	    -12
67 #define CUDBG_STATUS_UNREGISTERED	    -13
68 #define CUDBG_STATUS_UNDEFINED_ENTITY	    -14
69 #define CUDBG_STATUS_REG_FAIlED		    -15
70 #define CUDBG_STATUS_DEVLOG_FAILED	    -16
71 #define CUDBG_STATUS_SMALL_BUFF		    -17
72 #define CUDBG_STATUS_CHKSUM_MISSMATCH	    -18
73 #define CUDBG_STATUS_NO_SCRATCH_MEM	    -19
74 #define CUDBG_STATUS_OUTBUFF_OVERFLOW	    -20
75 #define CUDBG_STATUS_INVALID_BUFF	    -21  /* Invalid magic */
76 #define CUDBG_STATUS_FILE_OPEN_FAIL	    -22
77 #define CUDBG_STATUS_DEVLOG_INT_FAIL	    -23
78 #define CUDBG_STATUS_ENTITY_NOT_FOUND	    -24
79 #define CUDBG_STATUS_DECOMPRESS_FAIL	    -25
80 #define CUDBG_STATUS_BUFFER_SHORT	    -26
81 #define CUDBG_METADATA_VERSION_MISMATCH     -27
82 #define CUDBG_STATUS_NOT_IMPLEMENTED	    -28
83 #define CUDBG_SYSTEM_ERROR		    -29
84 #define CUDBG_STATUS_MMAP_FAILED	    -30
85 #define CUDBG_STATUS_FILE_WRITE_FAILED	    -31
86 #define CUDBG_STATUS_CCLK_NOT_DEFINED	    -32
87 #define CUDBG_STATUS_FLASH_FULL            -33
88 #define CUDBG_STATUS_SECTOR_EMPTY          -34
89 #define CUDBG_STATUS_ENTITY_NOT_REQUESTED  -35
90 #define CUDBG_STATUS_NOT_SUPPORTED         -36
91 #define CUDBG_STATUS_FILE_READ_FAILED      -37
92 #define CUDBG_STATUS_CORRUPTED             -38
93 #define CUDBG_STATUS_INVALID_INDEX         -39
94 
95 #define CUDBG_MAJOR_VERSION		    1
96 #define CUDBG_MINOR_VERSION		    14
97 #define CUDBG_BUILD_VERSION		    0
98 
99 #define CUDBG_FILE_NAME_LEN 256
100 #define CUDBG_DIR_NAME_LEN  256
101 #define CUDBG_MAX_BITMAP_LEN 16
102 
103 static char ATTRIBUTE_UNUSED * err_msg[] = {
104 	"Success",
105 	"Unknown",
106 	"No space",
107 	"Flash write fail",
108 	"Flash read fail",
109 	"Undefined out buf",
110 	"Callback function undefined",
111 	"Print callback function undefined",
112 	"ADAP invalid",
113 	"Flash empty",
114 	"No adapter",
115 	"No signature",
116 	"Multiple registration",
117 	"Unregistered",
118 	"Undefined entity",
119 	"Reg failed",
120 	"Devlog failed",
121 	"Small buff",
122 	"Checksum mismatch",
123 	"No scratch memory",
124 	"Outbuff overflow",
125 	"Invalid buffer",
126 	"File open fail",
127 	"Devlog int fail",
128 	"Entity not found",
129 	"Decompress fail",
130 	"Buffer short",
131 	"Version mismatch",
132 	"Not implemented",
133 	"System error",
134 	"Mmap failed",
135 	"File write failed",
136 	"cclk not defined",
137 	"Flash full",
138 	"Sector empty",
139 	"Entity not requested",
140 	"Not supported",
141 	"File read fail",
142 	"Corrupted",
143 	"Invalid Index"
144 };
145 
146 enum CUDBG_DBG_ENTITY_TYPE {
147 	CUDBG_ALL	   = 0,
148 	CUDBG_REG_DUMP	   = 1,
149 	CUDBG_DEV_LOG	   = 2,
150 	CUDBG_CIM_LA	   = 3,
151 	CUDBG_CIM_MA_LA    = 4,
152 	CUDBG_CIM_QCFG	   = 5,
153 	CUDBG_CIM_IBQ_TP0  = 6,
154 	CUDBG_CIM_IBQ_TP1  = 7,
155 	CUDBG_CIM_IBQ_ULP  = 8,
156 	CUDBG_CIM_IBQ_SGE0 = 9,
157 	CUDBG_CIM_IBQ_SGE1 = 10,
158 	CUDBG_CIM_IBQ_NCSI = 11,
159 	CUDBG_CIM_OBQ_ULP0 = 12,
160 	CUDBG_CIM_OBQ_ULP1 = 13,
161 	CUDBG_CIM_OBQ_ULP2 = 14,
162 	CUDBG_CIM_OBQ_ULP3 = 15,
163 	CUDBG_CIM_OBQ_SGE  = 16,
164 	CUDBG_CIM_OBQ_NCSI = 17,
165 	CUDBG_EDC0	   = 18,
166 	CUDBG_EDC1	   = 19,
167 	CUDBG_MC0	   = 20,
168 	CUDBG_MC1	   = 21,
169 	CUDBG_RSS	   = 22,
170 	CUDBG_RSS_PF_CONF  = 23,
171 	CUDBG_RSS_KEY	   = 24,
172 	CUDBG_RSS_VF_CONF  = 25,
173 	CUDBG_RSS_CONF	   = 26,
174 	CUDBG_PATH_MTU	   = 27,
175 	CUDBG_SW_STATE	   = 28,
176 	CUDBG_WTP	   = 29,
177 	CUDBG_PM_STATS	   = 30,
178 	CUDBG_HW_SCHED	   = 31,
179 	CUDBG_TCP_STATS    = 32,
180 	CUDBG_TP_ERR_STATS = 33,
181 	CUDBG_FCOE_STATS   = 34,
182 	CUDBG_RDMA_STATS   = 35,
183 	CUDBG_TP_INDIRECT  = 36,
184 	CUDBG_SGE_INDIRECT = 37,
185 	CUDBG_CPL_STATS    = 38,
186 	CUDBG_DDP_STATS    = 39,
187 	CUDBG_WC_STATS	   = 40,
188 	CUDBG_ULPRX_LA	   = 41,
189 	CUDBG_LB_STATS	   = 42,
190 	CUDBG_TP_LA	   = 43,
191 	CUDBG_MEMINFO	   = 44,
192 	CUDBG_CIM_PIF_LA   = 45,
193 	CUDBG_CLK	   = 46,
194 	CUDBG_CIM_OBQ_RXQ0 = 47,
195 	CUDBG_CIM_OBQ_RXQ1 = 48,
196 	CUDBG_MAC_STATS    = 49,
197 	CUDBG_PCIE_INDIRECT = 50,
198 	CUDBG_PM_INDIRECT  = 51,
199 	CUDBG_FULL	   = 52,
200 	CUDBG_TX_RATE	   = 53,
201 	CUDBG_TID_INFO	   = 54,
202 	CUDBG_PCIE_CONFIG  = 55,
203 	CUDBG_DUMP_CONTEXT = 56,
204 	CUDBG_MPS_TCAM	   = 57,
205 	CUDBG_VPD_DATA	   = 58,
206 	CUDBG_LE_TCAM	   = 59,
207 	CUDBG_CCTRL	   = 60,
208 	CUDBG_MA_INDIRECT  = 61,
209 	CUDBG_ULPTX_LA	   = 62,
210 	CUDBG_EXT_ENTITY   = 63,
211 	CUDBG_UP_CIM_INDIRECT = 64,
212 	CUDBG_PBT_TABLE    = 65,
213 	CUDBG_MBOX_LOG     = 66,
214 	CUDBG_HMA_INDIRECT = 67,
215 	CUDBG_MAX_ENTITY   = 68,
216 };
217 
218 #define ENTITY_FLAG_NULL 0
219 #define ENTITY_FLAG_REGISTER 1
220 #define ENTITY_FLAG_BINARY 2
221 #define ENTITY_FLAG_FW_NO_ATTACH    3
222 
223 /* file_name matches Linux cxgb4 debugfs entry names. */
224 struct el {char *name; char *file_name; int bit; u32 flag; };
225 static struct el ATTRIBUTE_UNUSED entity_list[] = {
226 	{"all", "all", CUDBG_ALL, ENTITY_FLAG_NULL},
227 	{"regdump", "regdump", CUDBG_REG_DUMP, 1 << ENTITY_FLAG_REGISTER},
228 	/* {"reg", CUDBG_REG_DUMP},*/
229 	{"devlog", "devlog", CUDBG_DEV_LOG, ENTITY_FLAG_NULL},
230 	{"cimla", "cim_la", CUDBG_CIM_LA, ENTITY_FLAG_NULL},
231 	{"cimmala", "cim_ma_la", CUDBG_CIM_MA_LA, ENTITY_FLAG_NULL},
232 	{"cimqcfg", "cim_qcfg", CUDBG_CIM_QCFG, ENTITY_FLAG_NULL},
233 	{"ibqtp0", "ibq_tp0", CUDBG_CIM_IBQ_TP0, ENTITY_FLAG_NULL},
234 	{"ibqtp1", "ibq_tp1", CUDBG_CIM_IBQ_TP1, ENTITY_FLAG_NULL},
235 	{"ibqulp", "ibq_ulp", CUDBG_CIM_IBQ_ULP, ENTITY_FLAG_NULL},
236 	{"ibqsge0", "ibq_sge0", CUDBG_CIM_IBQ_SGE0, ENTITY_FLAG_NULL},
237 	{"ibqsge1", "ibq_sge1", CUDBG_CIM_IBQ_SGE1, ENTITY_FLAG_NULL},
238 	{"ibqncsi", "ibq_ncsi", CUDBG_CIM_IBQ_NCSI, ENTITY_FLAG_NULL},
239 	{"obqulp0", "obq_ulp0", CUDBG_CIM_OBQ_ULP0, ENTITY_FLAG_NULL},
240 	/* {"cimobqulp1", CUDBG_CIM_OBQ_ULP1},*/
241 	{"obqulp1", "obq_ulp1", CUDBG_CIM_OBQ_ULP1, ENTITY_FLAG_NULL},
242 	{"obqulp2", "obq_ulp2", CUDBG_CIM_OBQ_ULP2, ENTITY_FLAG_NULL},
243 	{"obqulp3", "obq_ulp3", CUDBG_CIM_OBQ_ULP3, ENTITY_FLAG_NULL},
244 	{"obqsge", "obq_sge", CUDBG_CIM_OBQ_SGE, ENTITY_FLAG_NULL},
245 	{"obqncsi", "obq_ncsi", CUDBG_CIM_OBQ_NCSI, ENTITY_FLAG_NULL},
246 	{"edc0", "edc0", CUDBG_EDC0, (1 << ENTITY_FLAG_BINARY)},
247 	{"edc1", "edc1", CUDBG_EDC1, (1 << ENTITY_FLAG_BINARY)},
248 	{"mc0", "mc0", CUDBG_MC0, (1 << ENTITY_FLAG_BINARY)},
249 	{"mc1", "mc1", CUDBG_MC1, (1 << ENTITY_FLAG_BINARY)},
250 	{"rss", "rss", CUDBG_RSS, ENTITY_FLAG_NULL},
251 	{"rss_pf_config", "rss_pf_config", CUDBG_RSS_PF_CONF, ENTITY_FLAG_NULL},
252 	{"rss_key", "rss_key", CUDBG_RSS_KEY, ENTITY_FLAG_NULL},
253 	{"rss_vf_config", "rss_vf_config", CUDBG_RSS_VF_CONF, ENTITY_FLAG_NULL},
254 	{"rss_config", "rss_config", CUDBG_RSS_CONF, ENTITY_FLAG_NULL},
255 	{"pathmtu", "path_mtus", CUDBG_PATH_MTU, ENTITY_FLAG_NULL},
256 	{"swstate", "sw_state", CUDBG_SW_STATE, ENTITY_FLAG_NULL},
257 	{"wtp", "wtp", CUDBG_WTP, ENTITY_FLAG_NULL},
258 	{"pmstats", "pm_stats", CUDBG_PM_STATS, ENTITY_FLAG_NULL},
259 	{"hwsched", "hw_sched", CUDBG_HW_SCHED, ENTITY_FLAG_NULL},
260 	{"tcpstats", "tcp_stats", CUDBG_TCP_STATS, ENTITY_FLAG_NULL},
261 	{"tperrstats", "tp_err_stats", CUDBG_TP_ERR_STATS, ENTITY_FLAG_NULL},
262 	{"fcoestats", "fcoe_stats", CUDBG_FCOE_STATS, ENTITY_FLAG_NULL},
263 	{"rdmastats", "rdma_stats", CUDBG_RDMA_STATS, ENTITY_FLAG_NULL},
264 	{"tpindirect", "tp_indirect", CUDBG_TP_INDIRECT,
265 					1 << ENTITY_FLAG_REGISTER},
266 	{"sgeindirect", "sge_indirect", CUDBG_SGE_INDIRECT,
267 					1 << ENTITY_FLAG_REGISTER},
268 	{"cplstats", "cpl_stats", CUDBG_CPL_STATS, ENTITY_FLAG_NULL},
269 	{"ddpstats", "ddp_stats", CUDBG_DDP_STATS, ENTITY_FLAG_NULL},
270 	{"wcstats", "wc_stats", CUDBG_WC_STATS, ENTITY_FLAG_NULL},
271 	{"ulprxla", "ulprx_la", CUDBG_ULPRX_LA, ENTITY_FLAG_NULL},
272 	{"lbstats", "lb_stats", CUDBG_LB_STATS, ENTITY_FLAG_NULL},
273 	{"tpla", "tp_la", CUDBG_TP_LA, ENTITY_FLAG_NULL},
274 	{"meminfo", "meminfo", CUDBG_MEMINFO, ENTITY_FLAG_NULL},
275 	{"cimpifla", "cim_pif_la", CUDBG_CIM_PIF_LA, ENTITY_FLAG_NULL},
276 	{"clk", "clk", CUDBG_CLK, ENTITY_FLAG_NULL},
277 	{"obq_sge_rx_q0", "obq_sge_rx_q0", CUDBG_CIM_OBQ_RXQ0,
278 					ENTITY_FLAG_NULL},
279 	{"obq_sge_rx_q1", "obq_sge_rx_q1", CUDBG_CIM_OBQ_RXQ1,
280 					ENTITY_FLAG_NULL},
281 	{"macstats", "mac_stats", CUDBG_MAC_STATS, ENTITY_FLAG_NULL},
282 	{"pcieindirect", "pcie_indirect", CUDBG_PCIE_INDIRECT,
283 					1 << ENTITY_FLAG_REGISTER},
284 	{"pmindirect", "pm_indirect", CUDBG_PM_INDIRECT,
285 				1 << ENTITY_FLAG_REGISTER},
286 	{"full", "full", CUDBG_FULL, ENTITY_FLAG_NULL},
287 	{"txrate", "tx_rate", CUDBG_TX_RATE, ENTITY_FLAG_NULL},
288 	{"tidinfo", "tids", CUDBG_TID_INFO, ENTITY_FLAG_NULL |
289 				(1 << ENTITY_FLAG_FW_NO_ATTACH)},
290 	{"pcieconfig", "pcie_config", CUDBG_PCIE_CONFIG, ENTITY_FLAG_NULL},
291 	{"dumpcontext", "dump_context", CUDBG_DUMP_CONTEXT, ENTITY_FLAG_NULL},
292 	{"mpstcam", "mps_tcam", CUDBG_MPS_TCAM, ENTITY_FLAG_NULL},
293 	{"vpddata", "vpd_data", CUDBG_VPD_DATA, ENTITY_FLAG_NULL},
294 	{"letcam", "le_tcam", CUDBG_LE_TCAM, ENTITY_FLAG_NULL},
295 	{"cctrl", "cctrl", CUDBG_CCTRL, ENTITY_FLAG_NULL},
296 	{"maindirect", "ma_indirect", CUDBG_MA_INDIRECT,
297 				1 << ENTITY_FLAG_REGISTER},
298 	{"ulptxla", "ulptx_la", CUDBG_ULPTX_LA, ENTITY_FLAG_NULL},
299 	{"extentity", "ext_entity", CUDBG_EXT_ENTITY, ENTITY_FLAG_NULL},
300 	{"upcimindirect", "up_cim_indirect", CUDBG_UP_CIM_INDIRECT,
301 					1 << ENTITY_FLAG_REGISTER},
302 	{"pbttables", "pbt_tables", CUDBG_PBT_TABLE, ENTITY_FLAG_NULL},
303 	{"mboxlog", "mboxlog", CUDBG_MBOX_LOG, ENTITY_FLAG_NULL},
304 	{"hmaindirect", "hma_indirect", CUDBG_HMA_INDIRECT,
305 				1 << ENTITY_FLAG_REGISTER},
306 };
307 
308 typedef int (*cudbg_print_cb) (char *str, ...);
309 
310 struct cudbg_init_hdr {
311 	u8   major_ver;
312 	u8   minor_ver;
313 	u8   build_ver;
314 	u8   res;
315 	u16  init_struct_size;
316 };
317 
318 struct cudbg_flash_hdr {
319 	u32 signature;
320 	u8 major_ver;
321 	u8 minor_ver;
322 	u8 build_ver;
323 	u8 res;
324 	u64 timestamp;
325 	u64 time_res;
326 	u32 hdr_len;
327 	u32 data_len;
328 	u32 hdr_flags;
329 	u32 sec_seq_no;
330 	u32 reserved[22];
331 };
332 
333 struct cudbg_param {
334 	u16			 param_type;
335 	u16			 reserved;
336 	union {
337 		struct {
338 			u32 memtype;	/* which memory (EDC0, EDC1, MC) */
339 			u32 start;	/* start of log in firmware memory */
340 			u32 size;	/* size of log */
341 		} devlog_param;
342 		struct {
343 			struct mbox_cmd_log *log;
344 			u16 mbox_cmds;
345 		} mboxlog_param;
346 		struct {
347 			u8 caller_string[100];
348 			u8 os_type;
349 		} sw_state_param;
350 		u64 time;
351 		u8 tcb_bit_param;
352 		void *adap;
353 		void *access_lock;
354 	} u;
355 };
356 
357 /* params for tcb_bit_param */
358 #define CUDBG_TCB_BRIEF_PARAM      0x1
359 #define CUDBG_TCB_FROM_CARD_PARAM  0x2
360 #define CUDBG_TCB_AS_SCB_PARAM     0x4
361 
362 /*
363  * * What is OFFLINE_VIEW_ONLY mode?
364  *
365  * cudbg frame work will be used only to interpret previously collected
366  * data store in a file (i.e NOT hw flash)
367  */
368 
369 struct cudbg_init {
370 	struct cudbg_init_hdr	 header;
371 	struct adapter		 *adap;		 /* Pointer to adapter structure
372 						    with filled fields */
373 	cudbg_print_cb		 print;		 /* Platform dependent print
374 						    function */
375 	u32			 verbose:1;	 /* Turn on verbose print */
376 	u32			 use_flash:1;	 /* Use flash to collect or view
377 						    debug */
378 	u32			 full_mode:1;	 /* If set, cudbg will pull in
379 						    common code */
380 	u32			 no_compress:1;  /* Dont compress will storing
381 						    the collected debug */
382 	u32			 info:1;	 /* Show just the info, Dont
383 						    interpret */
384 	u32			 reserved:27;
385 	u8			 dbg_bitmap[CUDBG_MAX_BITMAP_LEN];
386 						/* Bit map to select the dbg
387 						    data type to be collected
388 						    or viewed */
389 };
390 
391 
392 /********************************* Helper functions *************************/
393 static inline void set_dbg_bitmap(u8 *bitmap, enum CUDBG_DBG_ENTITY_TYPE type)
394 {
395 	int index = type / 8;
396 	int bit = type % 8;
397 
398 	bitmap[index] |= (1 << bit);
399 }
400 
401 static inline void reset_dbg_bitmap(u8 *bitmap, enum CUDBG_DBG_ENTITY_TYPE type)
402 {
403 	int index = type / 8;
404 	int bit = type % 8;
405 
406 	bitmap[index] &= ~(1 << bit);
407 }
408 
409 /********************************* End of Helper functions
410  * *************************/
411 
412 /* API Prototypes */
413 
414 /**
415  *  cudbg_alloc_handle - Allocates and initializes a handle that represents
416  *  cudbg state.  Needs to called first before calling any other function.
417  *
418  *  returns a pointer to memory that has a cudbg_init structure at the beginning
419  *  and enough space after that for internal book keeping.
420  */
421 
422 void *cudbg_alloc_handle(void);
423 static inline struct cudbg_init *cudbg_get_init(void *handle)
424 {
425 	return (handle);
426 }
427 
428 /**
429  *  cudbg_collect - Collect and store debug information.
430  *  ## Parameters ##
431  *  @handle : A pointer returned by cudbg_alloc_handle.
432  *  @outbuf : pointer to output buffer, to store the collected information
433  *	      or to use it as a scratch buffer in case HW flash is used to
434  *	      store the debug information.
435  *  @outbuf_size : Size of output buffer.
436  *  ##	Return ##
437  *  If the function succeeds, the return value will be size of debug information
438  *  collected and stored.
439  *  -ve value represent error.
440  */
441 int cudbg_collect(void *handle, void *outbuf, u32 *outbuf_size);
442 
443 /**
444  *  cudbg_free_handle - Release cudbg resources.
445  *  ## Parameters ##
446  *  @handle : A pointer returned by cudbg_alloc_handle.
447  */
448 
449 void cudbg_free_handle(IN void *handle);
450 
451 /**
452  *  cudbg_read_flash_data - Read cudbg “flash” header from adapter flash.
453  *			    This will be used by the consumer mainly to
454  *			    know the size of the data in flash.
455  *  ## Parameters ##
456  *  @handle : A pointer returned by cudbg_hello.
457  *  @data : A pointer to data/header buffer
458  */
459 
460 int cudbg_read_flash_details(void *handle, struct cudbg_flash_hdr *data);
461 
462 /**
463  *  cudbg_read_flash_data - Read cudbg dump contents stored in flash.
464  *  ## Parameters ##
465  *  @handle : A pointer returned by cudbg_hello.
466  *  @data_buf : A pointer to data buffer.
467  *  @data_buf_size : Data buffer size.
468  */
469 
470 int cudbg_read_flash_data(void *handle, void *data_buf, u32 data_buf_size);
471 
472 #endif /* _CUDBG_IF_H_ */
473