1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2021 Hisilicon Limited. */
4 #ifndef __HNS3_DEBUGFS_H
5 #define __HNS3_DEBUGFS_H
9 #define HNS3_DBG_READ_LEN 65536
10 #define HNS3_DBG_READ_LEN_128KB 0x20000
11 #define HNS3_DBG_READ_LEN_1MB 0x100000
12 #define HNS3_DBG_READ_LEN_4MB 0x400000
13 #define HNS3_DBG_READ_LEN_5MB 0x500000
14 #define HNS3_DBG_WRITE_LEN 1024
16 #define HNS3_DBG_DATA_STR_LEN 32
17 #define HNS3_DBG_INFO_LEN 256
18 #define HNS3_DBG_ITEM_NAME_LEN 32
19 #define HNS3_DBG_FILE_NAME_LEN 16
21 struct hns3_dbg_item
{
22 char name
[HNS3_DBG_ITEM_NAME_LEN
];
23 u16 interval
; /* blank numbers after the item */
26 struct hns3_dbg_data
{
27 struct hnae3_handle
*handle
;
28 enum hnae3_dbg_cmd cmd
;
32 enum hns3_dbg_dentry_type
{
34 HNS3_DBG_DENTRY_TX_BD
,
35 HNS3_DBG_DENTRY_RX_BD
,
38 HNS3_DBG_DENTRY_QUEUE
,
40 HNS3_DBG_DENTRY_COMMON
,
43 struct hns3_dbg_dentry_info
{
45 struct dentry
*dentry
;
48 struct hns3_dbg_cmd_info
{
50 enum hnae3_dbg_cmd cmd
;
51 enum hns3_dbg_dentry_type dentry
;
53 int (*init
)(struct hnae3_handle
*handle
, unsigned int cmd
);
56 struct hns3_dbg_func
{
57 enum hnae3_dbg_cmd cmd
;
58 int (*dbg_dump
)(struct hnae3_handle
*handle
, char *buf
, int len
);
59 int (*dbg_dump_bd
)(struct hns3_dbg_data
*data
, char *buf
, int len
);
62 struct hns3_dbg_cap_info
{
64 enum HNAE3_DEV_CAP_BITS cap_bit
;