1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
4  */
5 
6 #ifndef __CUDBG_IF_H__
7 #define __CUDBG_IF_H__
8 
9 /* Error codes */
10 #define CUDBG_STATUS_NO_MEM -19
11 #define CUDBG_STATUS_ENTITY_NOT_FOUND -24
12 #define CUDBG_STATUS_NOT_IMPLEMENTED -28
13 #define CUDBG_SYSTEM_ERROR -29
14 #define CUDBG_STATUS_CCLK_NOT_DEFINED -32
15 #define CUDBG_STATUS_PARTIAL_DATA -41
16 
17 #define CUDBG_MAJOR_VERSION 1
18 #define CUDBG_MINOR_VERSION 14
19 
20 enum cudbg_dbg_entity_type {
21 	CUDBG_REG_DUMP = 1,
22 	CUDBG_DEV_LOG = 2,
23 	CUDBG_CIM_LA = 3,
24 	CUDBG_CIM_MA_LA = 4,
25 	CUDBG_CIM_QCFG = 5,
26 	CUDBG_CIM_IBQ_TP0 = 6,
27 	CUDBG_CIM_IBQ_TP1 = 7,
28 	CUDBG_CIM_IBQ_ULP = 8,
29 	CUDBG_CIM_IBQ_SGE0 = 9,
30 	CUDBG_CIM_IBQ_SGE1 = 10,
31 	CUDBG_CIM_IBQ_NCSI = 11,
32 	CUDBG_CIM_OBQ_ULP0 = 12,
33 	CUDBG_CIM_OBQ_ULP1 = 13,
34 	CUDBG_CIM_OBQ_ULP2 = 14,
35 	CUDBG_CIM_OBQ_ULP3 = 15,
36 	CUDBG_CIM_OBQ_SGE = 16,
37 	CUDBG_CIM_OBQ_NCSI = 17,
38 	CUDBG_EDC0 = 18,
39 	CUDBG_EDC1 = 19,
40 	CUDBG_MC0 = 20,
41 	CUDBG_MC1 = 21,
42 	CUDBG_RSS = 22,
43 	CUDBG_RSS_VF_CONF = 25,
44 	CUDBG_PATH_MTU = 27,
45 	CUDBG_PM_STATS = 30,
46 	CUDBG_HW_SCHED = 31,
47 	CUDBG_TP_INDIRECT = 36,
48 	CUDBG_SGE_INDIRECT = 37,
49 	CUDBG_ULPRX_LA = 41,
50 	CUDBG_TP_LA = 43,
51 	CUDBG_MEMINFO = 44,
52 	CUDBG_CIM_PIF_LA = 45,
53 	CUDBG_CLK = 46,
54 	CUDBG_CIM_OBQ_RXQ0 = 47,
55 	CUDBG_CIM_OBQ_RXQ1 = 48,
56 	CUDBG_PCIE_INDIRECT = 50,
57 	CUDBG_PM_INDIRECT = 51,
58 	CUDBG_TID_INFO = 54,
59 	CUDBG_PCIE_CONFIG = 55,
60 	CUDBG_DUMP_CONTEXT = 56,
61 	CUDBG_MPS_TCAM = 57,
62 	CUDBG_VPD_DATA = 58,
63 	CUDBG_LE_TCAM = 59,
64 	CUDBG_CCTRL = 60,
65 	CUDBG_MA_INDIRECT = 61,
66 	CUDBG_ULPTX_LA = 62,
67 	CUDBG_UP_CIM_INDIRECT = 64,
68 	CUDBG_PBT_TABLE = 65,
69 	CUDBG_MBOX_LOG = 66,
70 	CUDBG_HMA_INDIRECT = 67,
71 	CUDBG_HMA = 68,
72 	CUDBG_QDESC = 70,
73 	CUDBG_FLASH = 71,
74 	CUDBG_MAX_ENTITY = 72,
75 };
76 
77 struct cudbg_init {
78 	struct adapter *adap; /* Pointer to adapter structure */
79 	void *outbuf; /* Output buffer */
80 	u32 outbuf_size;  /* Output buffer size */
81 	u8 compress_type; /* Type of compression to use */
82 	void *compress_buff; /* Compression buffer */
83 	u32 compress_buff_size; /* Compression buffer size */
84 	void *workspace; /* Workspace for zlib */
85 };
86 
87 static inline unsigned int cudbg_mbytes_to_bytes(unsigned int size)
88 {
89 	return size * 1024 * 1024;
90 }
91 #endif /* __CUDBG_IF_H__ */
92