1 /* SPDX-License-Identifier: GPL-2.0 */
3 * linux/drivers/message/fusion/mptdebug.h
4 * For use with LSI PCI chip/adapter(s)
5 * running LSI Fusion MPT (Message Passing Technology) firmware.
7 * Copyright (c) 1999-2008 LSI Corporation
8 * (mailto:DL-MPTFusionLinux@lsi.com)
11 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
13 #ifndef MPTDEBUG_H_INCLUDED
14 #define MPTDEBUG_H_INCLUDED
17 * debug level can be programmed on the fly via SysFS (hex values)
19 * Example: (programming for MPT_DEBUG_EVENTS on host 5)
21 * echo 8 > /sys/class/scsi_host/host5/debug_level
23 * --------------------------------------------------------
24 * mpt_debug_level - command line parameter
25 * this allow enabling debug at driver load time (for all iocs)
27 * Example (programming for MPT_DEBUG_EVENTS)
29 * insmod mptbase.ko mpt_debug_level=8
31 * --------------------------------------------------------
32 * CONFIG_FUSION_LOGGING - enables compiling debug into driver
33 * this can be enabled in the driver Makefile
36 * --------------------------------------------------------
37 * Please note most debug prints are set to logging priority = debug
38 * This is the lowest level, and most verbose. Please refer to manual
39 * pages for syslogd or syslogd-ng on how to configure this.
42 #define MPT_DEBUG 0x00000001
43 #define MPT_DEBUG_MSG_FRAME 0x00000002
44 #define MPT_DEBUG_SG 0x00000004
45 #define MPT_DEBUG_EVENTS 0x00000008
46 #define MPT_DEBUG_VERBOSE_EVENTS 0x00000010
47 #define MPT_DEBUG_INIT 0x00000020
48 #define MPT_DEBUG_EXIT 0x00000040
49 #define MPT_DEBUG_FAIL 0x00000080
50 #define MPT_DEBUG_TM 0x00000100
51 #define MPT_DEBUG_DV 0x00000200
52 #define MPT_DEBUG_REPLY 0x00000400
53 #define MPT_DEBUG_HANDSHAKE 0x00000800
54 #define MPT_DEBUG_CONFIG 0x00001000
55 #define MPT_DEBUG_DL 0x00002000
56 #define MPT_DEBUG_RESET 0x00008000
57 #define MPT_DEBUG_SCSI 0x00010000
58 #define MPT_DEBUG_IOCTL 0x00020000
59 #define MPT_DEBUG_FC 0x00080000
60 #define MPT_DEBUG_SAS 0x00100000
61 #define MPT_DEBUG_SAS_WIDE 0x00200000
62 #define MPT_DEBUG_36GB_MEM 0x00400000
65 * CONFIG_FUSION_LOGGING - enabled in Kconfig
68 #ifdef CONFIG_FUSION_LOGGING
69 #define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
71 if (IOC->debug_level & BITS) \
75 #define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
84 #define dprintk(IOC, CMD) \
85 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
87 #define dsgprintk(IOC, CMD) \
88 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
90 #define devtprintk(IOC, CMD) \
91 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
93 #define devtverboseprintk(IOC, CMD) \
94 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_VERBOSE_EVENTS)
96 #define dinitprintk(IOC, CMD) \
97 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
99 #define dexitprintk(IOC, CMD) \
100 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
102 #define dfailprintk(IOC, CMD) \
103 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
105 #define dtmprintk(IOC, CMD) \
106 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)
108 #define ddvprintk(IOC, CMD) \
109 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DV)
111 #define dreplyprintk(IOC, CMD) \
112 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)
114 #define dhsprintk(IOC, CMD) \
115 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)
117 #define dcprintk(IOC, CMD) \
118 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)
120 #define ddlprintk(IOC, CMD) \
121 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)
123 #define drsprintk(IOC, CMD) \
124 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)
126 #define dsprintk(IOC, CMD) \
127 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)
129 #define dctlprintk(IOC, CMD) \
130 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)
132 #define dfcprintk(IOC, CMD) \
133 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FC)
135 #define dsasprintk(IOC, CMD) \
136 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)
138 #define dsaswideprintk(IOC, CMD) \
139 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)
141 #define d36memprintk(IOC, CMD) \
142 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_36GB_MEM)
148 #if defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING)
150 DBG_DUMP_FW_DOWNLOAD(MPT_ADAPTER
*ioc
, u32
*mfp
, int numfrags
)
154 if (!(ioc
->debug_level
& MPT_DEBUG
))
156 printk(KERN_DEBUG
"F/W download request:\n");
157 for (i
=0; i
< 7+numfrags
*2; i
++)
158 printk(" %08x", le32_to_cpu(mfp
[i
]));
163 DBG_DUMP_PUT_MSG_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
167 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
169 printk(KERN_DEBUG
"%s: About to Put msg frame @ %p:\n",
171 n
= ioc
->req_sz
/4 - 1;
174 for (ii
=0; ii
<=n
; ii
++) {
175 if (ii
&& ((ii
%8)==0))
177 printk(" %08x", le32_to_cpu(mfp
[ii
]));
183 DBG_DUMP_FW_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
187 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
190 printk(KERN_INFO
" ");
191 for (i
= 0; i
< n
; i
++)
192 printk(" %08x", le32_to_cpu(mfp
[i
]));
197 DBG_DUMP_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
201 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
204 for (i
=0; i
<n
; i
++) {
207 printk("%08x ", le32_to_cpu(mfp
[i
]));
213 DBG_DUMP_REPLY_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
217 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
219 n
= (le32_to_cpu(mfp
[0]) & 0x00FF0000) >> 16;
220 printk(KERN_INFO
" ");
222 printk(" %08x", le32_to_cpu(mfp
[i
]));
227 DBG_DUMP_REQUEST_FRAME_HDR(MPT_ADAPTER
*ioc
, u32
*mfp
)
231 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
234 printk(KERN_INFO
" ");
236 printk(" %08x", le32_to_cpu(mfp
[i
]));
241 DBG_DUMP_TM_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
245 if (!(ioc
->debug_level
& MPT_DEBUG_TM
))
248 printk(KERN_DEBUG
"TM_REQUEST:\n");
249 for (i
=0; i
<n
; i
++) {
252 printk("%08x ", le32_to_cpu(mfp
[i
]));
258 DBG_DUMP_TM_REPLY_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
262 if (!(ioc
->debug_level
& MPT_DEBUG_TM
))
264 n
= (le32_to_cpu(mfp
[0]) & 0x00FF0000) >> 16;
265 printk(KERN_DEBUG
"TM_REPLY MessageLength=%d:\n", n
);
266 for (i
=0; i
<n
; i
++) {
269 printk(" %08x", le32_to_cpu(mfp
[i
]));
274 #define dmfprintk(IOC, CMD) \
275 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
277 # else /* ifdef MPT_DEBUG_MF */
279 #define DBG_DUMP_FW_DOWNLOAD(IOC, mfp, numfrags)
280 #define DBG_DUMP_PUT_MSG_FRAME(IOC, mfp)
281 #define DBG_DUMP_FW_REQUEST_FRAME(IOC, mfp)
282 #define DBG_DUMP_REQUEST_FRAME(IOC, mfp)
283 #define DBG_DUMP_REPLY_FRAME(IOC, mfp)
284 #define DBG_DUMP_REQUEST_FRAME_HDR(IOC, mfp)
285 #define DBG_DUMP_TM_REQUEST_FRAME(IOC, mfp)
286 #define DBG_DUMP_TM_REPLY_FRAME(IOC, mfp)
288 #define dmfprintk(IOC, CMD) \
289 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
291 #endif /* defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING) */
293 #endif /* ifndef MPTDEBUG_H_INCLUDED */