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"
45 uint32_t qls_dbg_level = 0 ;
47 * Name: qls_dump_buf32
48 * Function: dumps a buffer as 32 bit words
51 qls_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
60 device_printf(dev, "%s: %s dump start\n", __func__, msg);
63 device_printf(dev,"0x%08x:\t0x%08x, 0x%08x, 0x%08x, 0x%08x,\n",
64 i, buf[0], buf[1], buf[2], buf[3]);
71 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
74 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
77 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
78 i, buf[0], buf[1], buf[2]);
83 device_printf(dev, "%s: %s dump end\n", __func__, msg);
89 * Name: qls_dump_buf16
90 * Function: dumps a buffer as 16 bit words
93 qls_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
102 device_printf(dev, "%s: %s dump start\n", __func__, msg);
105 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
106 " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
107 buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
114 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
117 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
120 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
121 i, buf[0], buf[1], buf[2]);
124 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
125 buf[0], buf[1], buf[2], buf[3]);
128 device_printf(dev,"0x%08x:"
129 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
130 buf[0], buf[1], buf[2], buf[3], buf[4]);
133 device_printf(dev,"0x%08x:"
134 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
135 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
138 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
139 " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
140 buf[2], buf[3], buf[4], buf[5], buf[6]);
145 device_printf(dev, "%s: %s dump end\n", __func__, msg);
151 * Name: qls_dump_buf8
152 * Function: dumps a buffer as bytes
155 qls_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
164 device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
167 device_printf(dev,"0x%08x:"
168 " %02x %02x %02x %02x %02x %02x %02x %02x"
169 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
170 buf[0], buf[1], buf[2], buf[3],
171 buf[4], buf[5], buf[6], buf[7],
172 buf[8], buf[9], buf[10], buf[11],
173 buf[12], buf[13], buf[14], buf[15]);
180 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
183 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
186 device_printf(dev,"0x%08x: %02x %02x %02x\n",
187 i, buf[0], buf[1], buf[2]);
190 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
191 buf[0], buf[1], buf[2], buf[3]);
194 device_printf(dev,"0x%08x:"
195 " %02x %02x %02x %02x %02x\n", i,
196 buf[0], buf[1], buf[2], buf[3], buf[4]);
199 device_printf(dev,"0x%08x:"
200 " %02x %02x %02x %02x %02x %02x\n", i,
201 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
204 device_printf(dev,"0x%08x:"
205 " %02x %02x %02x %02x %02x %02x %02x\n", i,
206 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
209 device_printf(dev,"0x%08x:"
210 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
211 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
215 device_printf(dev,"0x%08x:"
216 " %02x %02x %02x %02x %02x %02x %02x %02x"
218 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
222 device_printf(dev,"0x%08x:"
223 " %02x %02x %02x %02x %02x %02x %02x %02x"
225 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
226 buf[7], buf[8], buf[9]);
229 device_printf(dev,"0x%08x:"
230 " %02x %02x %02x %02x %02x %02x %02x %02x"
231 " %02x %02x %02x\n", i,
232 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
233 buf[7], buf[8], buf[9], buf[10]);
236 device_printf(dev,"0x%08x:"
237 " %02x %02x %02x %02x %02x %02x %02x %02x"
238 " %02x %02x %02x %02x\n", i,
239 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
240 buf[7], buf[8], buf[9], buf[10], buf[11]);
243 device_printf(dev,"0x%08x:"
244 " %02x %02x %02x %02x %02x %02x %02x %02x"
245 " %02x %02x %02x %02x %02x\n", i,
246 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
247 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
250 device_printf(dev,"0x%08x:"
251 " %02x %02x %02x %02x %02x %02x %02x %02x"
252 " %02x %02x %02x %02x %02x %02x\n", i,
253 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
254 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
258 device_printf(dev,"0x%08x:"
259 " %02x %02x %02x %02x %02x %02x %02x %02x"
260 " %02x %02x %02x %02x %02x %02x %02x\n", i,
261 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
262 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
269 device_printf(dev, "%s: %s dump end\n", __func__, msg);
275 qls_dump_cq(qla_host_t *ha)
277 qls_dump_buf32(ha, "cq_icb", ha->rx_ring[0].cq_icb_vaddr,
278 (sizeof (q81_cq_icb_t) >> 2));
280 device_printf(ha->pci_dev, "%s: lbq_addr_tbl_paddr %p\n", __func__,
281 (void *)ha->rx_ring[0].lbq_addr_tbl_paddr);
283 qls_dump_buf32(ha, "lbq_addr_tbl", ha->rx_ring[0].lbq_addr_tbl_vaddr,
286 device_printf(ha->pci_dev, "%s: lbq_paddr %p\n", __func__,
287 (void *)ha->rx_ring[0].lbq_paddr);
289 qls_dump_buf32(ha, "lbq", ha->rx_ring[0].lbq_vaddr,
290 (QLA_LBQ_SIZE >> 2));
292 device_printf(ha->pci_dev, "%s: sbq_addr_tbl_paddr %p\n", __func__,
293 (void *)ha->rx_ring[0].sbq_addr_tbl_paddr);
295 qls_dump_buf32(ha, "sbq_addr_tbl", ha->rx_ring[0].sbq_addr_tbl_vaddr,
298 device_printf(ha->pci_dev, "%s: sbq_paddr %p\n", __func__,
299 (void *)ha->rx_ring[0].sbq_paddr);
301 qls_dump_buf32(ha, "sbq", ha->rx_ring[0].sbq_vaddr,
302 (QLA_SBQ_SIZE >> 2) );
304 device_printf(ha->pci_dev, "%s: lb_paddr %p\n", __func__,
305 (void *)ha->rx_ring[0].lb_paddr);