1 /*
2  *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
3  *
4  *  This program is free software; you can redistribute it and/or modify it
5  *  under the terms and conditions of the GNU General Public License,
6  *  version 2, as published by the Free Software Foundation.
7  *
8  *  This program is distributed in the hope it will be useful, but WITHOUT
9  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  *  more details.
12  *
13  *  The full GNU General Public License is included in this distribution in
14  *  the file called "COPYING".
15  *
16  */
17 
18 #ifndef __CXGB4_CUDBG_H__
19 #define __CXGB4_CUDBG_H__
20 
21 #include "cudbg_if.h"
22 #include "cudbg_lib_common.h"
23 #include "cudbg_entity.h"
24 #include "cudbg_lib.h"
25 
26 #define CUDBG_DUMP_BUFF_SIZE (32 * 1024 * 1024) /* 32 MB */
27 #define CUDBG_COMPRESS_BUFF_SIZE (4 * 1024 * 1024) /* 4 MB */
28 
29 typedef int (*cudbg_collect_callback_t)(struct cudbg_init *pdbg_init,
30 					struct cudbg_buffer *dbg_buff,
31 					struct cudbg_error *cudbg_err);
32 
33 struct cxgb4_collect_entity {
34 	enum cudbg_dbg_entity_type entity;
35 	cudbg_collect_callback_t collect_cb;
36 };
37 
38 enum CXGB4_ETHTOOL_DUMP_FLAGS {
39 	CXGB4_ETH_DUMP_NONE = ETH_FW_DUMP_DISABLE,
40 	CXGB4_ETH_DUMP_MEM = (1 << 0), /* On-Chip Memory Dumps */
41 	CXGB4_ETH_DUMP_HW = (1 << 1), /* various FW and HW dumps */
42 };
43 
44 u32 cxgb4_get_dump_length(struct adapter *adap, u32 flag);
45 int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size,
46 			u32 flag);
47 void cxgb4_init_ethtool_dump(struct adapter *adapter);
48 #endif /* __CXGB4_CUDBG_H__ */
49