1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Driver for Broadcom MPI3 Storage Controllers
5 * Copyright (C) 2017-2021 Broadcom Inc.
6 * (mailto: mpi3mr-linuxdrv.pdl@broadcom.com)
10 #ifndef MPI3SAS_DEBUG_H_INCLUDED
12 #define MPI3SAS_DEBUG_H_INCLUDED
18 #define MPI3_DEBUG_EVENT 0x00000001
19 #define MPI3_DEBUG_EVENT_WORK_TASK 0x00000002
20 #define MPI3_DEBUG_INIT 0x00000004
21 #define MPI3_DEBUG_EXIT 0x00000008
22 #define MPI3_DEBUG_TM 0x00000010
23 #define MPI3_DEBUG_RESET 0x00000020
24 #define MPI3_DEBUG_SCSI_ERROR 0x00000040
25 #define MPI3_DEBUG_REPLY 0x00000080
26 #define MPI3_DEBUG_IOCTL_ERROR 0x00008000
27 #define MPI3_DEBUG_IOCTL_INFO 0x00010000
28 #define MPI3_DEBUG_SCSI_INFO 0x00020000
29 #define MPI3_DEBUG 0x01000000
30 #define MPI3_DEBUG_SG 0x02000000
37 #define ioc_err(ioc, fmt, ...) \
38 pr_err("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
39 #define ioc_notice(ioc, fmt, ...) \
40 pr_notice("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
41 #define ioc_warn(ioc, fmt, ...) \
42 pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
43 #define ioc_info(ioc, fmt, ...) \
44 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
46 #define dprint(ioc, fmt, ...) \
48 if (ioc->logging_level & MPI3_DEBUG) \
49 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
52 #define dprint_event_th(ioc, fmt, ...) \
54 if (ioc->logging_level & MPI3_DEBUG_EVENT) \
55 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
58 #define dprint_event_bh(ioc, fmt, ...) \
60 if (ioc->logging_level & MPI3_DEBUG_EVENT_WORK_TASK) \
61 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
64 #define dprint_init(ioc, fmt, ...) \
66 if (ioc->logging_level & MPI3_DEBUG_INIT) \
67 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
70 #define dprint_exit(ioc, fmt, ...) \
72 if (ioc->logging_level & MPI3_DEBUG_EXIT) \
73 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
76 #define dprint_tm(ioc, fmt, ...) \
78 if (ioc->logging_level & MPI3_DEBUG_TM) \
79 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
82 #define dprint_reply(ioc, fmt, ...) \
84 if (ioc->logging_level & MPI3_DEBUG_REPLY) \
85 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
88 #define dprint_reset(ioc, fmt, ...) \
90 if (ioc->logging_level & MPI3_DEBUG_RESET) \
91 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
94 #define dprint_scsi_info(ioc, fmt, ...) \
96 if (ioc->logging_level & MPI3_DEBUG_SCSI_INFO) \
97 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
100 #define dprint_scsi_err(ioc, fmt, ...) \
102 if (ioc->logging_level & MPI3_DEBUG_SCSI_ERROR) \
103 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
106 #define dprint_scsi_command(ioc, SCMD, LOG_LEVEL) \
108 if (ioc->logging_level & LOG_LEVEL) \
109 scsi_print_command(SCMD); \
113 #define dprint_ioctl_info(ioc, fmt, ...) \
115 if (ioc->logging_level & MPI3_DEBUG_IOCTL_INFO) \
116 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
119 #define dprint_ioctl_err(ioc, fmt, ...) \
121 if (ioc->logging_level & MPI3_DEBUG_IOCTL_ERROR) \
122 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__); \
125 #endif /* MPT3SAS_DEBUG_H_INCLUDED */
128 * dprint_dump_req - print message frame contents
129 * @req: pointer to message frame
130 * @sz: number of dwords
133 dprint_dump_req(void *req, int sz)
136 __le32 *mfp = (__le32 *)req;
138 pr_info("request:\n\t");
139 for (i = 0; i < sz; i++) {
140 if (i && ((i % 8) == 0))
142 pr_info("%08x ", le32_to_cpu(mfp[i]));