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 enum hnae3_dbg_cmd cmd; 26 u16 qid; 27 }; 28 29 enum hns3_dbg_dentry_type { 30 HNS3_DBG_DENTRY_TM, 31 HNS3_DBG_DENTRY_TX_BD, 32 HNS3_DBG_DENTRY_RX_BD, 33 HNS3_DBG_DENTRY_MAC, 34 HNS3_DBG_DENTRY_REG, 35 HNS3_DBG_DENTRY_QUEUE, 36 HNS3_DBG_DENTRY_FD, 37 HNS3_DBG_DENTRY_COMMON, 38 }; 39 40 struct hns3_dbg_dentry_info { 41 const char *name; 42 struct dentry *dentry; 43 }; 44 45 struct hns3_dbg_cmd_info { 46 const char *name; 47 enum hnae3_dbg_cmd cmd; 48 enum hns3_dbg_dentry_type dentry; 49 u32 buf_len; 50 char *buf; 51 int (*init)(struct hnae3_handle *handle, unsigned int cmd); 52 }; 53 54 struct hns3_dbg_func { 55 enum hnae3_dbg_cmd cmd; 56 int (*dbg_dump)(struct hnae3_handle *handle, char *buf, int len); 57 int (*dbg_dump_bd)(struct hns3_dbg_data *data, char *buf, int len); 58 }; 59 60 struct hns3_dbg_cap_info { 61 const char *name; 62 enum HNAE3_DEV_CAP_BITS cap_bit; 63 }; 64 65 #endif 66