2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2013-2014 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 "qls_inline.h"
44 uint32_t qls_dbg_level = 0 ;
46 * Name: qls_dump_buf32
47 * Function: dumps a buffer as 32 bit words
50 qls_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
59 device_printf(dev, "%s: %s dump start\n", __func__, msg);
62 device_printf(dev,"0x%08x:\t0x%08x, 0x%08x, 0x%08x, 0x%08x,\n",
63 i, buf[0], buf[1], buf[2], buf[3]);
70 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
73 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
76 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
77 i, buf[0], buf[1], buf[2]);
82 device_printf(dev, "%s: %s dump end\n", __func__, msg);
88 * Name: qls_dump_buf16
89 * Function: dumps a buffer as 16 bit words
92 qls_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
101 device_printf(dev, "%s: %s dump start\n", __func__, msg);
104 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
105 " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
106 buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
113 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
116 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
119 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
120 i, buf[0], buf[1], buf[2]);
123 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
124 buf[0], buf[1], buf[2], buf[3]);
127 device_printf(dev,"0x%08x:"
128 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
129 buf[0], buf[1], buf[2], buf[3], buf[4]);
132 device_printf(dev,"0x%08x:"
133 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
134 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
137 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
138 " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
139 buf[2], buf[3], buf[4], buf[5], buf[6]);
144 device_printf(dev, "%s: %s dump end\n", __func__, msg);
150 * Name: qls_dump_buf8
151 * Function: dumps a buffer as bytes
154 qls_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
163 device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
166 device_printf(dev,"0x%08x:"
167 " %02x %02x %02x %02x %02x %02x %02x %02x"
168 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
169 buf[0], buf[1], buf[2], buf[3],
170 buf[4], buf[5], buf[6], buf[7],
171 buf[8], buf[9], buf[10], buf[11],
172 buf[12], buf[13], buf[14], buf[15]);
179 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
182 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
185 device_printf(dev,"0x%08x: %02x %02x %02x\n",
186 i, buf[0], buf[1], buf[2]);
189 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
190 buf[0], buf[1], buf[2], buf[3]);
193 device_printf(dev,"0x%08x:"
194 " %02x %02x %02x %02x %02x\n", i,
195 buf[0], buf[1], buf[2], buf[3], buf[4]);
198 device_printf(dev,"0x%08x:"
199 " %02x %02x %02x %02x %02x %02x\n", i,
200 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
203 device_printf(dev,"0x%08x:"
204 " %02x %02x %02x %02x %02x %02x %02x\n", i,
205 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
208 device_printf(dev,"0x%08x:"
209 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
210 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
214 device_printf(dev,"0x%08x:"
215 " %02x %02x %02x %02x %02x %02x %02x %02x"
217 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
221 device_printf(dev,"0x%08x:"
222 " %02x %02x %02x %02x %02x %02x %02x %02x"
224 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
225 buf[7], buf[8], buf[9]);
228 device_printf(dev,"0x%08x:"
229 " %02x %02x %02x %02x %02x %02x %02x %02x"
230 " %02x %02x %02x\n", i,
231 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
232 buf[7], buf[8], buf[9], buf[10]);
235 device_printf(dev,"0x%08x:"
236 " %02x %02x %02x %02x %02x %02x %02x %02x"
237 " %02x %02x %02x %02x\n", i,
238 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
239 buf[7], buf[8], buf[9], buf[10], buf[11]);
242 device_printf(dev,"0x%08x:"
243 " %02x %02x %02x %02x %02x %02x %02x %02x"
244 " %02x %02x %02x %02x %02x\n", i,
245 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
246 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\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],
257 device_printf(dev,"0x%08x:"
258 " %02x %02x %02x %02x %02x %02x %02x %02x"
259 " %02x %02x %02x %02x %02x %02x %02x\n", i,
260 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
261 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
268 device_printf(dev, "%s: %s dump end\n", __func__, msg);
274 qls_dump_cq(qla_host_t *ha)
276 qls_dump_buf32(ha, "cq_icb", ha->rx_ring[0].cq_icb_vaddr,
277 (sizeof (q81_cq_icb_t) >> 2));
279 device_printf(ha->pci_dev, "%s: lbq_addr_tbl_paddr %p\n", __func__,
280 (void *)ha->rx_ring[0].lbq_addr_tbl_paddr);
282 qls_dump_buf32(ha, "lbq_addr_tbl", ha->rx_ring[0].lbq_addr_tbl_vaddr,
285 device_printf(ha->pci_dev, "%s: lbq_paddr %p\n", __func__,
286 (void *)ha->rx_ring[0].lbq_paddr);
288 qls_dump_buf32(ha, "lbq", ha->rx_ring[0].lbq_vaddr,
289 (QLA_LBQ_SIZE >> 2));
291 device_printf(ha->pci_dev, "%s: sbq_addr_tbl_paddr %p\n", __func__,
292 (void *)ha->rx_ring[0].sbq_addr_tbl_paddr);
294 qls_dump_buf32(ha, "sbq_addr_tbl", ha->rx_ring[0].sbq_addr_tbl_vaddr,
297 device_printf(ha->pci_dev, "%s: sbq_paddr %p\n", __func__,
298 (void *)ha->rx_ring[0].sbq_paddr);
300 qls_dump_buf32(ha, "sbq", ha->rx_ring[0].sbq_vaddr,
301 (QLA_SBQ_SIZE >> 2) );
303 device_printf(ha->pci_dev, "%s: lb_paddr %p\n", __func__,
304 (void *)ha->rx_ring[0].lb_paddr);