1
2
3
4
5
6
7 #ifndef _QEDI_DBG_H_
8 #define _QEDI_DBG_H_
9
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/compiler.h>
13 #include <linux/string.h>
14 #include <linux/version.h>
15 #include <linux/pci.h>
16 #include <linux/delay.h>
17 #include <scsi/scsi_transport.h>
18 #include <scsi/scsi_transport_iscsi.h>
19 #include <linux/fs.h>
20
21 #define __PREVENT_QED_HSI__
22 #include <linux/qed/common_hsi.h>
23 #include <linux/qed/qed_if.h>
24
25 extern uint qedi_dbg_log;
26
27
28 #define QEDI_LOG_DEFAULT 0x1
29 #define QEDI_LOG_INFO 0x2
30
31
32 #define QEDI_LOG_DISC 0x4
33 #define QEDI_LOG_LL2 0x8
34 #define QEDI_LOG_CONN 0x10
35 #define QEDI_LOG_EVT 0x20
36 #define QEDI_LOG_TIMER 0x40
37 #define QEDI_LOG_MP_REQ 0x80
38 #define QEDI_LOG_SCSI_TM 0x100
39 #define QEDI_LOG_UNSOL 0x200
40 #define QEDI_LOG_IO 0x400
41 #define QEDI_LOG_MQ 0x800
42 #define QEDI_LOG_BSG 0x1000
43 #define QEDI_LOG_DEBUGFS 0x2000
44 #define QEDI_LOG_LPORT 0x4000
45 #define QEDI_LOG_ELS 0x8000
46 #define QEDI_LOG_NPIV 0x10000
47 #define QEDI_LOG_SESS 0x20000
48 #define QEDI_LOG_UIO 0x40000
49 #define QEDI_LOG_TID 0x80000
50
51
52 #define QEDI_TRACK_TID 0x100000
53
54
55
56 #define QEDI_TRACK_CMD_LIST 0x300000
57
58
59
60 #define QEDI_LOG_NOTICE 0x40000000
61 #define QEDI_LOG_WARN 0x80000000
62
63
64 struct qedi_dbg_ctx {
65 unsigned int host_no;
66 struct pci_dev *pdev;
67 #ifdef CONFIG_DEBUG_FS
68 struct dentry *bdf_dentry;
69 #endif
70 };
71
72 #define QEDI_ERR(pdev, fmt, ...) \
73 qedi_dbg_err(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
74 #define QEDI_WARN(pdev, fmt, ...) \
75 qedi_dbg_warn(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
76 #define QEDI_NOTICE(pdev, fmt, ...) \
77 qedi_dbg_notice(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
78 #define QEDI_INFO(pdev, level, fmt, ...) \
79 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt, \
80 ## __VA_ARGS__)
81
82 void qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
83 const char *fmt, ...);
84 void qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
85 const char *fmt, ...);
86 void qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
87 const char *fmt, ...);
88 void qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
89 u32 info, const char *fmt, ...);
90
91 struct Scsi_Host;
92
93 struct sysfs_bin_attrs {
94 char *name;
95 struct bin_attribute *attr;
96 };
97
98 int qedi_create_sysfs_attr(struct Scsi_Host *shost,
99 struct sysfs_bin_attrs *iter);
100 void qedi_remove_sysfs_attr(struct Scsi_Host *shost,
101 struct sysfs_bin_attrs *iter);
102
103
104 struct qedi_list_of_funcs {
105 char *oper_str;
106 ssize_t (*oper_func)(struct qedi_dbg_ctx *qedi);
107 };
108
109 struct qedi_debugfs_ops {
110 char *name;
111 struct qedi_list_of_funcs *qedi_funcs;
112 };
113
114 #define qedi_dbg_fileops(drv, ops) \
115 { \
116 .owner = THIS_MODULE, \
117 .open = simple_open, \
118 .read = drv##_dbg_##ops##_cmd_read, \
119 .write = drv##_dbg_##ops##_cmd_write \
120 }
121
122
123 #define qedi_dbg_fileops_seq(drv, ops) \
124 { \
125 .owner = THIS_MODULE, \
126 .open = drv##_dbg_##ops##_open, \
127 .read = seq_read, \
128 .llseek = seq_lseek, \
129 .release = single_release, \
130 }
131
132 void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
133 const struct qedi_debugfs_ops *dops,
134 const struct file_operations *fops);
135 void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
136 void qedi_dbg_init(char *drv_name);
137 void qedi_dbg_exit(void);
138
139 #endif