2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2013-2016 Qlogic Corporation
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
31 * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
39 #include "ql_inline.h"
46 * Function: dumps a buffer as 32 bit words
48 void ql_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
57 device_printf(dev, "%s: %s dump start\n", __func__, msg);
60 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
61 i, buf[0], buf[1], buf[2], buf[3]);
68 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
71 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
74 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
75 i, buf[0], buf[1], buf[2]);
80 device_printf(dev, "%s: %s dump end\n", __func__, msg);
85 * Function: dumps a buffer as 16 bit words
87 void ql_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
96 device_printf(dev, "%s: %s dump start\n", __func__, msg);
99 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
100 " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
101 buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
108 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
111 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
114 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
115 i, buf[0], buf[1], buf[2]);
118 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
119 buf[0], buf[1], buf[2], buf[3]);
122 device_printf(dev,"0x%08x:"
123 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
124 buf[0], buf[1], buf[2], buf[3], buf[4]);
127 device_printf(dev,"0x%08x:"
128 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
129 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
132 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
133 " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
134 buf[2], buf[3], buf[4], buf[5], buf[6]);
139 device_printf(dev, "%s: %s dump end\n", __func__, msg);
144 * Function: dumps a buffer as bytes
146 void ql_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
155 device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
158 device_printf(dev,"0x%08x:"
159 " %02x %02x %02x %02x %02x %02x %02x %02x"
160 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
161 buf[0], buf[1], buf[2], buf[3],
162 buf[4], buf[5], buf[6], buf[7],
163 buf[8], buf[9], buf[10], buf[11],
164 buf[12], buf[13], buf[14], buf[15]);
171 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
174 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
177 device_printf(dev,"0x%08x: %02x %02x %02x\n",
178 i, buf[0], buf[1], buf[2]);
181 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
182 buf[0], buf[1], buf[2], buf[3]);
185 device_printf(dev,"0x%08x:"
186 " %02x %02x %02x %02x %02x\n", i,
187 buf[0], buf[1], buf[2], buf[3], buf[4]);
190 device_printf(dev,"0x%08x:"
191 " %02x %02x %02x %02x %02x %02x\n", i,
192 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
195 device_printf(dev,"0x%08x:"
196 " %02x %02x %02x %02x %02x %02x %02x\n", i,
197 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
200 device_printf(dev,"0x%08x:"
201 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
202 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
206 device_printf(dev,"0x%08x:"
207 " %02x %02x %02x %02x %02x %02x %02x %02x"
209 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
213 device_printf(dev,"0x%08x:"
214 " %02x %02x %02x %02x %02x %02x %02x %02x"
216 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
217 buf[7], buf[8], buf[9]);
220 device_printf(dev,"0x%08x:"
221 " %02x %02x %02x %02x %02x %02x %02x %02x"
222 " %02x %02x %02x\n", i,
223 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
224 buf[7], buf[8], buf[9], buf[10]);
227 device_printf(dev,"0x%08x:"
228 " %02x %02x %02x %02x %02x %02x %02x %02x"
229 " %02x %02x %02x %02x\n", i,
230 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
231 buf[7], buf[8], buf[9], buf[10], buf[11]);
234 device_printf(dev,"0x%08x:"
235 " %02x %02x %02x %02x %02x %02x %02x %02x"
236 " %02x %02x %02x %02x %02x\n", i,
237 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
238 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
241 device_printf(dev,"0x%08x:"
242 " %02x %02x %02x %02x %02x %02x %02x %02x"
243 " %02x %02x %02x %02x %02x %02x\n", i,
244 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
245 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
249 device_printf(dev,"0x%08x:"
250 " %02x %02x %02x %02x %02x %02x %02x %02x"
251 " %02x %02x %02x %02x %02x %02x %02x\n", i,
252 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
253 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
260 device_printf(dev, "%s: %s dump end\n", __func__, msg);