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