0001
0002
0003
0004
0005
0006
0007 #ifndef _QEDI_DBG_H_
0008 #define _QEDI_DBG_H_
0009
0010 #include <linux/types.h>
0011 #include <linux/kernel.h>
0012 #include <linux/compiler.h>
0013 #include <linux/string.h>
0014 #include <linux/version.h>
0015 #include <linux/pci.h>
0016 #include <linux/delay.h>
0017 #include <scsi/scsi_transport.h>
0018 #include <scsi/scsi_transport_iscsi.h>
0019 #include <linux/fs.h>
0020
0021 #define __PREVENT_QED_HSI__
0022 #include <linux/qed/common_hsi.h>
0023 #include <linux/qed/qed_if.h>
0024
0025 extern uint qedi_dbg_log;
0026
0027
0028 #define QEDI_LOG_DEFAULT 0x1
0029 #define QEDI_LOG_INFO 0x2
0030
0031
0032 #define QEDI_LOG_DISC 0x4
0033 #define QEDI_LOG_LL2 0x8
0034 #define QEDI_LOG_CONN 0x10
0035 #define QEDI_LOG_EVT 0x20
0036 #define QEDI_LOG_TIMER 0x40
0037 #define QEDI_LOG_MP_REQ 0x80
0038 #define QEDI_LOG_SCSI_TM 0x100
0039 #define QEDI_LOG_UNSOL 0x200
0040 #define QEDI_LOG_IO 0x400
0041 #define QEDI_LOG_MQ 0x800
0042 #define QEDI_LOG_BSG 0x1000
0043 #define QEDI_LOG_DEBUGFS 0x2000
0044 #define QEDI_LOG_LPORT 0x4000
0045 #define QEDI_LOG_ELS 0x8000
0046 #define QEDI_LOG_NPIV 0x10000
0047 #define QEDI_LOG_SESS 0x20000
0048 #define QEDI_LOG_UIO 0x40000
0049 #define QEDI_LOG_TID 0x80000
0050
0051
0052 #define QEDI_TRACK_TID 0x100000
0053
0054
0055
0056 #define QEDI_TRACK_CMD_LIST 0x300000
0057
0058
0059
0060 #define QEDI_LOG_NOTICE 0x40000000
0061 #define QEDI_LOG_WARN 0x80000000
0062
0063
0064 struct qedi_dbg_ctx {
0065 unsigned int host_no;
0066 struct pci_dev *pdev;
0067 #ifdef CONFIG_DEBUG_FS
0068 struct dentry *bdf_dentry;
0069 #endif
0070 };
0071
0072 #define QEDI_ERR(pdev, fmt, ...) \
0073 qedi_dbg_err(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
0074 #define QEDI_WARN(pdev, fmt, ...) \
0075 qedi_dbg_warn(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
0076 #define QEDI_NOTICE(pdev, fmt, ...) \
0077 qedi_dbg_notice(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
0078 #define QEDI_INFO(pdev, level, fmt, ...) \
0079 qedi_dbg_info(pdev, __func__, __LINE__, level, fmt, \
0080 ## __VA_ARGS__)
0081
0082 void qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
0083 const char *fmt, ...);
0084 void qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
0085 const char *fmt, ...);
0086 void qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
0087 const char *fmt, ...);
0088 void qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
0089 u32 info, const char *fmt, ...);
0090
0091 struct Scsi_Host;
0092
0093 struct sysfs_bin_attrs {
0094 char *name;
0095 struct bin_attribute *attr;
0096 };
0097
0098 int qedi_create_sysfs_attr(struct Scsi_Host *shost,
0099 struct sysfs_bin_attrs *iter);
0100 void qedi_remove_sysfs_attr(struct Scsi_Host *shost,
0101 struct sysfs_bin_attrs *iter);
0102
0103
0104 struct qedi_list_of_funcs {
0105 char *oper_str;
0106 ssize_t (*oper_func)(struct qedi_dbg_ctx *qedi);
0107 };
0108
0109 struct qedi_debugfs_ops {
0110 char *name;
0111 struct qedi_list_of_funcs *qedi_funcs;
0112 };
0113
0114 #define qedi_dbg_fileops(drv, ops) \
0115 { \
0116 .owner = THIS_MODULE, \
0117 .open = simple_open, \
0118 .read = drv##_dbg_##ops##_cmd_read, \
0119 .write = drv##_dbg_##ops##_cmd_write \
0120 }
0121
0122
0123 #define qedi_dbg_fileops_seq(drv, ops) \
0124 { \
0125 .owner = THIS_MODULE, \
0126 .open = drv##_dbg_##ops##_open, \
0127 .read = seq_read, \
0128 .llseek = seq_lseek, \
0129 .release = single_release, \
0130 }
0131
0132 void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
0133 const struct qedi_debugfs_ops *dops,
0134 const struct file_operations *fops);
0135 void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
0136 void qedi_dbg_init(char *drv_name);
0137 void qedi_dbg_exit(void);
0138
0139 #endif