2 * linux/drivers/message/fusion/mptdebug.h
3 * For use with LSI PCI chip/adapter(s)
4 * running LSI Fusion MPT (Message Passing Technology) firmware.
6 * Copyright (c) 1999-2008 LSI Corporation
7 * (mailto:DL-MPTFusionLinux@lsi.com)
10 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
12 #ifndef MPTDEBUG_H_INCLUDED
13 #define MPTDEBUG_H_INCLUDED
16 * debug level can be programmed on the fly via SysFS (hex values)
18 * Example: (programming for MPT_DEBUG_EVENTS on host 5)
20 * echo 8 > /sys/class/scsi_host/host5/debug_level
22 * --------------------------------------------------------
23 * mpt_debug_level - command line parameter
24 * this allow enabling debug at driver load time (for all iocs)
26 * Example (programming for MPT_DEBUG_EVENTS)
28 * insmod mptbase.ko mpt_debug_level=8
30 * --------------------------------------------------------
31 * CONFIG_FUSION_LOGGING - enables compiling debug into driver
32 * this can be enabled in the driver Makefile
35 * --------------------------------------------------------
36 * Please note most debug prints are set to logging priority = debug
37 * This is the lowest level, and most verbose. Please refer to manual
38 * pages for syslogd or syslogd-ng on how to configure this.
41 #define MPT_DEBUG 0x00000001
42 #define MPT_DEBUG_MSG_FRAME 0x00000002
43 #define MPT_DEBUG_SG 0x00000004
44 #define MPT_DEBUG_EVENTS 0x00000008
45 #define MPT_DEBUG_VERBOSE_EVENTS 0x00000010
46 #define MPT_DEBUG_INIT 0x00000020
47 #define MPT_DEBUG_EXIT 0x00000040
48 #define MPT_DEBUG_FAIL 0x00000080
49 #define MPT_DEBUG_TM 0x00000100
50 #define MPT_DEBUG_DV 0x00000200
51 #define MPT_DEBUG_REPLY 0x00000400
52 #define MPT_DEBUG_HANDSHAKE 0x00000800
53 #define MPT_DEBUG_CONFIG 0x00001000
54 #define MPT_DEBUG_DL 0x00002000
55 #define MPT_DEBUG_RESET 0x00008000
56 #define MPT_DEBUG_SCSI 0x00010000
57 #define MPT_DEBUG_IOCTL 0x00020000
58 #define MPT_DEBUG_FC 0x00080000
59 #define MPT_DEBUG_SAS 0x00100000
60 #define MPT_DEBUG_SAS_WIDE 0x00200000
61 #define MPT_DEBUG_36GB_MEM 0x00400000
64 * CONFIG_FUSION_LOGGING - enabled in Kconfig
67 #ifdef CONFIG_FUSION_LOGGING
68 #define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
70 if (IOC->debug_level & BITS) \
74 #define MPT_CHECK_LOGGING(IOC, CMD, BITS)
82 #define dprintk(IOC, CMD) \
83 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
85 #define dsgprintk(IOC, CMD) \
86 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
88 #define devtprintk(IOC, CMD) \
89 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
91 #define devtverboseprintk(IOC, CMD) \
92 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_VERBOSE_EVENTS)
94 #define dinitprintk(IOC, CMD) \
95 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
97 #define dexitprintk(IOC, CMD) \
98 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
100 #define dfailprintk(IOC, CMD) \
101 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
103 #define dtmprintk(IOC, CMD) \
104 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)
106 #define ddvprintk(IOC, CMD) \
107 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DV)
109 #define dreplyprintk(IOC, CMD) \
110 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)
112 #define dhsprintk(IOC, CMD) \
113 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)
115 #define dcprintk(IOC, CMD) \
116 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)
118 #define ddlprintk(IOC, CMD) \
119 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)
121 #define drsprintk(IOC, CMD) \
122 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)
124 #define dsprintk(IOC, CMD) \
125 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)
127 #define dctlprintk(IOC, CMD) \
128 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)
130 #define dfcprintk(IOC, CMD) \
131 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FC)
133 #define dsasprintk(IOC, CMD) \
134 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)
136 #define dsaswideprintk(IOC, CMD) \
137 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)
139 #define d36memprintk(IOC, CMD) \
140 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_36GB_MEM)
146 #if defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING)
148 DBG_DUMP_FW_DOWNLOAD(MPT_ADAPTER
*ioc
, u32
*mfp
, int numfrags
)
152 if (!(ioc
->debug_level
& MPT_DEBUG
))
154 printk(KERN_DEBUG
"F/W download request:\n");
155 for (i
=0; i
< 7+numfrags
*2; i
++)
156 printk(" %08x", le32_to_cpu(mfp
[i
]));
161 DBG_DUMP_PUT_MSG_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
165 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
167 printk(KERN_DEBUG
"%s: About to Put msg frame @ %p:\n",
169 n
= ioc
->req_sz
/4 - 1;
172 for (ii
=0; ii
<=n
; ii
++) {
173 if (ii
&& ((ii
%8)==0))
175 printk(" %08x", le32_to_cpu(mfp
[ii
]));
181 DBG_DUMP_FW_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
185 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
188 printk(KERN_INFO
" ");
189 for (i
= 0; i
< n
; i
++)
190 printk(" %08x", le32_to_cpu(mfp
[i
]));
195 DBG_DUMP_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
199 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
202 for (i
=0; i
<n
; i
++) {
205 printk("%08x ", le32_to_cpu(mfp
[i
]));
211 DBG_DUMP_REPLY_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
215 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
217 n
= (le32_to_cpu(mfp
[0]) & 0x00FF0000) >> 16;
218 printk(KERN_INFO
" ");
220 printk(" %08x", le32_to_cpu(mfp
[i
]));
225 DBG_DUMP_REQUEST_FRAME_HDR(MPT_ADAPTER
*ioc
, u32
*mfp
)
229 if (!(ioc
->debug_level
& MPT_DEBUG_MSG_FRAME
))
232 printk(KERN_INFO
" ");
234 printk(" %08x", le32_to_cpu(mfp
[i
]));
239 DBG_DUMP_TM_REQUEST_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
243 if (!(ioc
->debug_level
& MPT_DEBUG_TM
))
246 printk(KERN_DEBUG
"TM_REQUEST:\n");
247 for (i
=0; i
<n
; i
++) {
250 printk("%08x ", le32_to_cpu(mfp
[i
]));
256 DBG_DUMP_TM_REPLY_FRAME(MPT_ADAPTER
*ioc
, u32
*mfp
)
260 if (!(ioc
->debug_level
& MPT_DEBUG_TM
))
262 n
= (le32_to_cpu(mfp
[0]) & 0x00FF0000) >> 16;
263 printk(KERN_DEBUG
"TM_REPLY MessageLength=%d:\n", n
);
264 for (i
=0; i
<n
; i
++) {
267 printk(" %08x", le32_to_cpu(mfp
[i
]));
272 #define dmfprintk(IOC, CMD) \
273 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
275 # else /* ifdef MPT_DEBUG_MF */
277 #define DBG_DUMP_FW_DOWNLOAD(IOC, mfp, numfrags)
278 #define DBG_DUMP_PUT_MSG_FRAME(IOC, mfp)
279 #define DBG_DUMP_FW_REQUEST_FRAME(IOC, mfp)
280 #define DBG_DUMP_REQUEST_FRAME(IOC, mfp)
281 #define DBG_DUMP_REPLY_FRAME(IOC, mfp)
282 #define DBG_DUMP_REQUEST_FRAME_HDR(IOC, mfp)
283 #define DBG_DUMP_TM_REQUEST_FRAME(IOC, mfp)
284 #define DBG_DUMP_TM_REPLY_FRAME(IOC, mfp)
286 #define dmfprintk(IOC, CMD) \
287 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
289 #endif /* defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING) */
291 #endif /* ifndef MPTDEBUG_H_INCLUDED */