xref: /linux/drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.h (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
4  */
5 
6 #ifndef __CXGB4_CUDBG_H__
7 #define __CXGB4_CUDBG_H__
8 
9 #include "cudbg_if.h"
10 #include "cudbg_lib_common.h"
11 #include "cudbg_entity.h"
12 #include "cudbg_lib.h"
13 
14 #define CUDBG_DUMP_BUFF_SIZE (32 * 1024 * 1024) /* 32 MB */
15 #define CUDBG_COMPRESS_BUFF_SIZE (4 * 1024 * 1024) /* 4 MB */
16 
17 typedef int (*cudbg_collect_callback_t)(struct cudbg_init *pdbg_init,
18 					struct cudbg_buffer *dbg_buff,
19 					struct cudbg_error *cudbg_err);
20 
21 struct cxgb4_collect_entity {
22 	enum cudbg_dbg_entity_type entity;
23 	cudbg_collect_callback_t collect_cb;
24 };
25 
26 enum CXGB4_ETHTOOL_DUMP_FLAGS {
27 	CXGB4_ETH_DUMP_NONE = ETH_FW_DUMP_DISABLE,
28 	CXGB4_ETH_DUMP_MEM = (1 << 0), /* On-Chip Memory Dumps */
29 	CXGB4_ETH_DUMP_HW = (1 << 1), /* various FW and HW dumps */
30 	CXGB4_ETH_DUMP_FLASH = (1 << 2), /* Dump flash memory */
31 };
32 
33 #define CXGB4_ETH_DUMP_ALL (CXGB4_ETH_DUMP_MEM | CXGB4_ETH_DUMP_HW)
34 
35 u32 cxgb4_get_dump_length(struct adapter *adap, u32 flag);
36 int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size,
37 			u32 flag);
38 void cxgb4_init_ethtool_dump(struct adapter *adapter);
39 int cxgb4_cudbg_vmcore_add_dump(struct adapter *adap);
40 #endif /* __CXGB4_CUDBG_H__ */
41