1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45#ifndef MPT3SAS_DEBUG_H_INCLUDED
46#define MPT3SAS_DEBUG_H_INCLUDED
47
48#define MPT_DEBUG 0x00000001
49#define MPT_DEBUG_MSG_FRAME 0x00000002
50#define MPT_DEBUG_SG 0x00000004
51#define MPT_DEBUG_EVENTS 0x00000008
52#define MPT_DEBUG_EVENT_WORK_TASK 0x00000010
53#define MPT_DEBUG_INIT 0x00000020
54#define MPT_DEBUG_EXIT 0x00000040
55#define MPT_DEBUG_FAIL 0x00000080
56#define MPT_DEBUG_TM 0x00000100
57#define MPT_DEBUG_REPLY 0x00000200
58#define MPT_DEBUG_HANDSHAKE 0x00000400
59#define MPT_DEBUG_CONFIG 0x00000800
60#define MPT_DEBUG_DL 0x00001000
61#define MPT_DEBUG_RESET 0x00002000
62#define MPT_DEBUG_SCSI 0x00004000
63#define MPT_DEBUG_IOCTL 0x00008000
64#define MPT_DEBUG_SAS 0x00020000
65#define MPT_DEBUG_TRANSPORT 0x00040000
66#define MPT_DEBUG_TASK_SET_FULL 0x00080000
67
68#define MPT_DEBUG_TRIGGER_DIAG 0x00200000
69
70
71#define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
72{ \
73 if (IOC->logging_level & BITS) \
74 CMD; \
75}
76
77
78
79
80
81#define dprintk(IOC, CMD) \
82 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
83
84#define dsgprintk(IOC, CMD) \
85 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
86
87#define devtprintk(IOC, CMD) \
88 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
89
90#define dewtprintk(IOC, CMD) \
91 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENT_WORK_TASK)
92
93#define dinitprintk(IOC, CMD) \
94 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
95
96#define dexitprintk(IOC, CMD) \
97 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
98
99#define dfailprintk(IOC, CMD) \
100 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
101
102#define dtmprintk(IOC, CMD) \
103 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)
104
105#define dreplyprintk(IOC, CMD) \
106 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)
107
108#define dhsprintk(IOC, CMD) \
109 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)
110
111#define dcprintk(IOC, CMD) \
112 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)
113
114#define ddlprintk(IOC, CMD) \
115 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)
116
117#define drsprintk(IOC, CMD) \
118 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)
119
120#define dsprintk(IOC, CMD) \
121 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)
122
123#define dctlprintk(IOC, CMD) \
124 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)
125
126#define dsasprintk(IOC, CMD) \
127 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)
128
129#define dsastransport(IOC, CMD) \
130 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)
131
132#define dmfprintk(IOC, CMD) \
133 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
134
135#define dtsfprintk(IOC, CMD) \
136 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TASK_SET_FULL)
137
138#define dtransportprintk(IOC, CMD) \
139 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TRANSPORT)
140
141#define dTriggerDiagPrintk(IOC, CMD) \
142 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TRIGGER_DIAG)
143
144
145
146
147
148
149
150
151
152
153static inline void
154_debug_dump_mf(void *mpi_request, int sz)
155{
156 int i;
157 __le32 *mfp = (__le32 *)mpi_request;
158
159 pr_info("mf:\n\t");
160 for (i = 0; i < sz; i++) {
161 if (i && ((i % 8) == 0))
162 pr_info("\n\t");
163 pr_info("%08x ", le32_to_cpu(mfp[i]));
164 }
165 pr_info("\n");
166}
167
168
169
170
171
172static inline void
173_debug_dump_reply(void *mpi_request, int sz)
174{
175 int i;
176 __le32 *mfp = (__le32 *)mpi_request;
177
178 pr_info("reply:\n\t");
179 for (i = 0; i < sz; i++) {
180 if (i && ((i % 8) == 0))
181 pr_info("\n\t");
182 pr_info("%08x ", le32_to_cpu(mfp[i]));
183 }
184 pr_info("\n");
185}
186
187
188
189
190
191static inline void
192_debug_dump_config(void *mpi_request, int sz)
193{
194 int i;
195 __le32 *mfp = (__le32 *)mpi_request;
196
197 pr_info("config:\n\t");
198 for (i = 0; i < sz; i++) {
199 if (i && ((i % 8) == 0))
200 pr_info("\n\t");
201 pr_info("%08x ", le32_to_cpu(mfp[i]));
202 }
203 pr_info("\n");
204}
205
206#endif
207