1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2021 Hisilicon Limited. */
3 
4 #ifndef __HNS3_DEBUGFS_H
5 #define __HNS3_DEBUGFS_H
6 
7 #define HNS3_DBG_READ_LEN	65536
8 #define HNS3_DBG_READ_LEN_128KB	0x20000
9 #define HNS3_DBG_READ_LEN_1MB	0x100000
10 #define HNS3_DBG_READ_LEN_4MB	0x400000
11 #define HNS3_DBG_WRITE_LEN	1024
12 
13 #define HNS3_DBG_DATA_STR_LEN	32
14 #define HNS3_DBG_INFO_LEN	256
15 #define HNS3_DBG_ITEM_NAME_LEN	32
16 #define HNS3_DBG_FILE_NAME_LEN	16
17 
18 struct hns3_dbg_item {
19 	char name[HNS3_DBG_ITEM_NAME_LEN];
20 	u16 interval; /* blank numbers after the item */
21 };
22 
23 struct hns3_dbg_data {
24 	struct hnae3_handle *handle;
25 	u16 qid;
26 };
27 
28 enum hns3_dbg_dentry_type {
29 	HNS3_DBG_DENTRY_TM,
30 	HNS3_DBG_DENTRY_TX_BD,
31 	HNS3_DBG_DENTRY_RX_BD,
32 	HNS3_DBG_DENTRY_MAC,
33 	HNS3_DBG_DENTRY_REG,
34 	HNS3_DBG_DENTRY_QUEUE,
35 	HNS3_DBG_DENTRY_FD,
36 	HNS3_DBG_DENTRY_COMMON,
37 };
38 
39 struct hns3_dbg_dentry_info {
40 	const char *name;
41 	struct dentry *dentry;
42 };
43 
44 struct hns3_dbg_cmd_info {
45 	const char *name;
46 	enum hnae3_dbg_cmd cmd;
47 	enum hns3_dbg_dentry_type dentry;
48 	u32 buf_len;
49 	char *buf;
50 	int (*init)(struct hnae3_handle *handle, unsigned int cmd);
51 };
52 
53 struct hns3_dbg_func {
54 	enum hnae3_dbg_cmd cmd;
55 	int (*dbg_dump)(struct hnae3_handle *handle, char *buf, int len);
56 	int (*dbg_dump_bd)(struct hns3_dbg_data *data, char *buf, int len);
57 };
58 
59 struct hns3_dbg_cap_info {
60 	const char *name;
61 	enum HNAE3_DEV_CAP_BITS cap_bit;
62 };
63 
64 #endif
65