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 "qls_inline.h"
43 uint32_t qls_dbg_level = 0 ;
45 * Name: qls_dump_buf32
46 * Function: dumps a buffer as 32 bit words
49 qls_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
58 device_printf(dev, "%s: %s dump start\n", __func__, msg);
61 device_printf(dev,"0x%08x:\t0x%08x, 0x%08x, 0x%08x, 0x%08x,\n",
62 i, buf[0], buf[1], buf[2], buf[3]);
69 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
72 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
75 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
76 i, buf[0], buf[1], buf[2]);
81 device_printf(dev, "%s: %s dump end\n", __func__, msg);
87 * Name: qls_dump_buf16
88 * Function: dumps a buffer as 16 bit words
91 qls_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
100 device_printf(dev, "%s: %s dump start\n", __func__, msg);
103 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
104 " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
105 buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
112 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
115 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
118 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
119 i, buf[0], buf[1], buf[2]);
122 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
123 buf[0], buf[1], buf[2], buf[3]);
126 device_printf(dev,"0x%08x:"
127 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
128 buf[0], buf[1], buf[2], buf[3], buf[4]);
131 device_printf(dev,"0x%08x:"
132 " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
133 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
136 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
137 " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
138 buf[2], buf[3], buf[4], buf[5], buf[6]);
143 device_printf(dev, "%s: %s dump end\n", __func__, msg);
149 * Name: qls_dump_buf8
150 * Function: dumps a buffer as bytes
153 qls_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
162 device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
165 device_printf(dev,"0x%08x:"
166 " %02x %02x %02x %02x %02x %02x %02x %02x"
167 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
168 buf[0], buf[1], buf[2], buf[3],
169 buf[4], buf[5], buf[6], buf[7],
170 buf[8], buf[9], buf[10], buf[11],
171 buf[12], buf[13], buf[14], buf[15]);
178 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
181 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
184 device_printf(dev,"0x%08x: %02x %02x %02x\n",
185 i, buf[0], buf[1], buf[2]);
188 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
189 buf[0], buf[1], buf[2], buf[3]);
192 device_printf(dev,"0x%08x:"
193 " %02x %02x %02x %02x %02x\n", i,
194 buf[0], buf[1], buf[2], buf[3], buf[4]);
197 device_printf(dev,"0x%08x:"
198 " %02x %02x %02x %02x %02x %02x\n", i,
199 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
202 device_printf(dev,"0x%08x:"
203 " %02x %02x %02x %02x %02x %02x %02x\n", i,
204 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
207 device_printf(dev,"0x%08x:"
208 " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
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],
220 device_printf(dev,"0x%08x:"
221 " %02x %02x %02x %02x %02x %02x %02x %02x"
223 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
224 buf[7], buf[8], buf[9]);
227 device_printf(dev,"0x%08x:"
228 " %02x %02x %02x %02x %02x %02x %02x %02x"
229 " %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]);
234 device_printf(dev,"0x%08x:"
235 " %02x %02x %02x %02x %02x %02x %02x %02x"
236 " %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]);
241 device_printf(dev,"0x%08x:"
242 " %02x %02x %02x %02x %02x %02x %02x %02x"
243 " %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]);
248 device_printf(dev,"0x%08x:"
249 " %02x %02x %02x %02x %02x %02x %02x %02x"
250 " %02x %02x %02x %02x %02x %02x\n", i,
251 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
252 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
256 device_printf(dev,"0x%08x:"
257 " %02x %02x %02x %02x %02x %02x %02x %02x"
258 " %02x %02x %02x %02x %02x %02x %02x\n", i,
259 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
260 buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
267 device_printf(dev, "%s: %s dump end\n", __func__, msg);
273 qls_dump_cq(qla_host_t *ha)
275 qls_dump_buf32(ha, "cq_icb", ha->rx_ring[0].cq_icb_vaddr,
276 (sizeof (q81_cq_icb_t) >> 2));
278 device_printf(ha->pci_dev, "%s: lbq_addr_tbl_paddr %p\n", __func__,
279 (void *)ha->rx_ring[0].lbq_addr_tbl_paddr);
281 qls_dump_buf32(ha, "lbq_addr_tbl", ha->rx_ring[0].lbq_addr_tbl_vaddr,
284 device_printf(ha->pci_dev, "%s: lbq_paddr %p\n", __func__,
285 (void *)ha->rx_ring[0].lbq_paddr);
287 qls_dump_buf32(ha, "lbq", ha->rx_ring[0].lbq_vaddr,
288 (QLA_LBQ_SIZE >> 2));
290 device_printf(ha->pci_dev, "%s: sbq_addr_tbl_paddr %p\n", __func__,
291 (void *)ha->rx_ring[0].sbq_addr_tbl_paddr);
293 qls_dump_buf32(ha, "sbq_addr_tbl", ha->rx_ring[0].sbq_addr_tbl_vaddr,
296 device_printf(ha->pci_dev, "%s: sbq_paddr %p\n", __func__,
297 (void *)ha->rx_ring[0].sbq_paddr);
299 qls_dump_buf32(ha, "sbq", ha->rx_ring[0].sbq_vaddr,
300 (QLA_SBQ_SIZE >> 2) );
302 device_printf(ha->pci_dev, "%s: lb_paddr %p\n", __func__,
303 (void *)ha->rx_ring[0].lb_paddr);