2 * Copyright (c) 2013-2014 Qlogic Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
29 * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
31 #include <sys/cdefs.h>
32 __FBSDID("$FreeBSD$");
37 #include "ql_inline.h"
44 * Function: dumps a buffer as 32 bit words
46 void ql_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
55 device_printf(dev, "%s: %s dump start\n", __func__, msg);
58 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
59 i, buf[0], buf[1], buf[2], buf[3]);
66 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
69 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
72 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
73 i, buf[0], buf[1], buf[2]);
78 device_printf(dev, "%s: %s dump end\n", __func__, msg);
83 * Function: dumps a buffer as 16 bit words
85 void ql_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
94 device_printf(dev, "%s: %s dump start\n", __func__, msg);
97 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
98 " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
99 buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
106 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
109 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
112 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
113 i, buf[0], buf[1], buf[2]);
116 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
117 buf[0], buf[1], buf[2], buf[3]);
120 device_printf(dev,"0x%08x:"
121 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
122 buf[0], buf[1], buf[2], buf[3], buf[4]);
125 device_printf(dev,"0x%08x:"
126 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
127 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
130 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
131 " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
132 buf[2], buf[3], buf[4], buf[5], buf[6]);
137 device_printf(dev, "%s: %s dump end\n", __func__, msg);
142 * Function: dumps a buffer as bytes
144 void ql_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
153 device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
156 device_printf(dev,"0x%08x:"
157 " %02x %02x %02x %02x %02x %02x %02x %02x"
158 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
159 buf[0], buf[1], buf[2], buf[3],
160 buf[4], buf[5], buf[6], buf[7],
161 buf[8], buf[9], buf[10], buf[11],
162 buf[12], buf[13], buf[14], buf[15]);
169 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
172 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
175 device_printf(dev,"0x%08x: %02x %02x %02x\n",
176 i, buf[0], buf[1], buf[2]);
179 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
180 buf[0], buf[1], buf[2], buf[3]);
183 device_printf(dev,"0x%08x:"
184 " %02x %02x %02x %02x %02x\n", i,
185 buf[0], buf[1], buf[2], buf[3], buf[4]);
188 device_printf(dev,"0x%08x:"
189 " %02x %02x %02x %02x %02x %02x\n", i,
190 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
193 device_printf(dev,"0x%08x:"
194 " %02x %02x %02x %02x %02x %02x %02x\n", i,
195 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
198 device_printf(dev,"0x%08x:"
199 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
200 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
204 device_printf(dev,"0x%08x:"
205 " %02x %02x %02x %02x %02x %02x %02x %02x"
207 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
211 device_printf(dev,"0x%08x:"
212 " %02x %02x %02x %02x %02x %02x %02x %02x"
214 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
215 buf[7], buf[8], buf[9]);
218 device_printf(dev,"0x%08x:"
219 " %02x %02x %02x %02x %02x %02x %02x %02x"
220 " %02x %02x %02x\n", i,
221 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
222 buf[7], buf[8], buf[9], buf[10]);
225 device_printf(dev,"0x%08x:"
226 " %02x %02x %02x %02x %02x %02x %02x %02x"
227 " %02x %02x %02x %02x\n", i,
228 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
229 buf[7], buf[8], buf[9], buf[10], buf[11]);
232 device_printf(dev,"0x%08x:"
233 " %02x %02x %02x %02x %02x %02x %02x %02x"
234 " %02x %02x %02x %02x %02x\n", i,
235 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
236 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
239 device_printf(dev,"0x%08x:"
240 " %02x %02x %02x %02x %02x %02x %02x %02x"
241 " %02x %02x %02x %02x %02x %02x\n", i,
242 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
243 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
247 device_printf(dev,"0x%08x:"
248 " %02x %02x %02x %02x %02x %02x %02x %02x"
249 " %02x %02x %02x %02x %02x %02x %02x\n", i,
250 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
251 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
258 device_printf(dev, "%s: %s dump end\n", __func__, msg);