0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef MPI3SAS_DEBUG_H_INCLUDED
0011
0012 #define MPI3SAS_DEBUG_H_INCLUDED
0013
0014
0015
0016
0017
0018 #define MPI3_DEBUG_EVENT 0x00000001
0019 #define MPI3_DEBUG_EVENT_WORK_TASK 0x00000002
0020 #define MPI3_DEBUG_INIT 0x00000004
0021 #define MPI3_DEBUG_EXIT 0x00000008
0022 #define MPI3_DEBUG_TM 0x00000010
0023 #define MPI3_DEBUG_RESET 0x00000020
0024 #define MPI3_DEBUG_SCSI_ERROR 0x00000040
0025 #define MPI3_DEBUG_REPLY 0x00000080
0026 #define MPI3_DEBUG_BSG_ERROR 0x00008000
0027 #define MPI3_DEBUG_BSG_INFO 0x00010000
0028 #define MPI3_DEBUG_SCSI_INFO 0x00020000
0029 #define MPI3_DEBUG 0x01000000
0030 #define MPI3_DEBUG_SG 0x02000000
0031
0032
0033
0034
0035
0036
0037 #define ioc_err(ioc, fmt, ...) \
0038 pr_err("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
0039 #define ioc_notice(ioc, fmt, ...) \
0040 pr_notice("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
0041 #define ioc_warn(ioc, fmt, ...) \
0042 pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
0043 #define ioc_info(ioc, fmt, ...) \
0044 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
0045
0046 #define dprint(ioc, fmt, ...) \
0047 do { \
0048 if (ioc->logging_level & MPI3_DEBUG) \
0049 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0050 } while (0)
0051
0052 #define dprint_event_th(ioc, fmt, ...) \
0053 do { \
0054 if (ioc->logging_level & MPI3_DEBUG_EVENT) \
0055 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0056 } while (0)
0057
0058 #define dprint_event_bh(ioc, fmt, ...) \
0059 do { \
0060 if (ioc->logging_level & MPI3_DEBUG_EVENT_WORK_TASK) \
0061 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0062 } while (0)
0063
0064 #define dprint_init(ioc, fmt, ...) \
0065 do { \
0066 if (ioc->logging_level & MPI3_DEBUG_INIT) \
0067 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0068 } while (0)
0069
0070 #define dprint_exit(ioc, fmt, ...) \
0071 do { \
0072 if (ioc->logging_level & MPI3_DEBUG_EXIT) \
0073 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0074 } while (0)
0075
0076 #define dprint_tm(ioc, fmt, ...) \
0077 do { \
0078 if (ioc->logging_level & MPI3_DEBUG_TM) \
0079 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0080 } while (0)
0081
0082 #define dprint_reply(ioc, fmt, ...) \
0083 do { \
0084 if (ioc->logging_level & MPI3_DEBUG_REPLY) \
0085 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0086 } while (0)
0087
0088 #define dprint_reset(ioc, fmt, ...) \
0089 do { \
0090 if (ioc->logging_level & MPI3_DEBUG_RESET) \
0091 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0092 } while (0)
0093
0094 #define dprint_scsi_info(ioc, fmt, ...) \
0095 do { \
0096 if (ioc->logging_level & MPI3_DEBUG_SCSI_INFO) \
0097 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0098 } while (0)
0099
0100 #define dprint_scsi_err(ioc, fmt, ...) \
0101 do { \
0102 if (ioc->logging_level & MPI3_DEBUG_SCSI_ERROR) \
0103 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0104 } while (0)
0105
0106 #define dprint_scsi_command(ioc, SCMD, LOG_LEVEL) \
0107 do { \
0108 if (ioc->logging_level & LOG_LEVEL) \
0109 scsi_print_command(SCMD); \
0110 } while (0)
0111
0112
0113 #define dprint_bsg_info(ioc, fmt, ...) \
0114 do { \
0115 if (ioc->logging_level & MPI3_DEBUG_BSG_INFO) \
0116 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0117 } while (0)
0118
0119 #define dprint_bsg_err(ioc, fmt, ...) \
0120 do { \
0121 if (ioc->logging_level & MPI3_DEBUG_BSG_ERROR) \
0122 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
0123 } while (0)
0124
0125 #endif
0126
0127
0128
0129
0130
0131
0132
0133 static inline void
0134 dprint_dump(void *req, int sz, const char *name_string)
0135 {
0136 int i;
0137 __le32 *mfp = (__le32 *)req;
0138
0139 sz = sz/4;
0140 if (name_string)
0141 pr_info("%s:\n\t", name_string);
0142 else
0143 pr_info("request:\n\t");
0144 for (i = 0; i < sz; i++) {
0145 if (i && ((i % 8) == 0))
0146 pr_info("\n\t");
0147 pr_info("%08x ", le32_to_cpu(mfp[i]));
0148 }
0149 pr_info("\n");
0150 }
0151
0152
0153
0154
0155
0156
0157 static inline void
0158 dprint_dump_req(void *req, int sz)
0159 {
0160 int i;
0161 __le32 *mfp = (__le32 *)req;
0162
0163 pr_info("request:\n\t");
0164 for (i = 0; i < sz; i++) {
0165 if (i && ((i % 8) == 0))
0166 pr_info("\n\t");
0167 pr_info("%08x ", le32_to_cpu(mfp[i]));
0168 }
0169 pr_info("\n");
0170 }