xref: /freebsd/sys/dev/qlxge/qls_dbg.h (revision 95ee2897)
1718cf2ccSPedro F. Giffuni /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4711bcba0SDavid C Somayajulu  * Copyright (c) 2013-2014 Qlogic Corporation
5711bcba0SDavid C Somayajulu  * All rights reserved.
6711bcba0SDavid C Somayajulu  *
7711bcba0SDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
8711bcba0SDavid C Somayajulu  *  modification, are permitted provided that the following conditions
9711bcba0SDavid C Somayajulu  *  are met:
10711bcba0SDavid C Somayajulu  *
11711bcba0SDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
12711bcba0SDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
13711bcba0SDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
14711bcba0SDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
15711bcba0SDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
16711bcba0SDavid C Somayajulu  *
17711bcba0SDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18711bcba0SDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19711bcba0SDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20711bcba0SDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21711bcba0SDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22711bcba0SDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23711bcba0SDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24711bcba0SDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25711bcba0SDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26711bcba0SDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27711bcba0SDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
28711bcba0SDavid C Somayajulu  */
29711bcba0SDavid C Somayajulu 
30711bcba0SDavid C Somayajulu /*
31711bcba0SDavid C Somayajulu  * File : qls_dbg.h
32711bcba0SDavid C Somayajulu  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
33711bcba0SDavid C Somayajulu  */
34711bcba0SDavid C Somayajulu 
35711bcba0SDavid C Somayajulu #ifndef _QL_DBG_H_
36711bcba0SDavid C Somayajulu #define _QL_DBG_H_
37711bcba0SDavid C Somayajulu 
38711bcba0SDavid C Somayajulu extern uint32_t qls_dbg_level;
39711bcba0SDavid C Somayajulu 
40711bcba0SDavid C Somayajulu extern void qls_dump_buf8(qla_host_t *ha, const char *str, void *dbuf,
41711bcba0SDavid C Somayajulu 		uint32_t len);
42711bcba0SDavid C Somayajulu extern void qls_dump_buf16(qla_host_t *ha, const char *str, void *dbuf,
43711bcba0SDavid C Somayajulu 		uint32_t len16);
44711bcba0SDavid C Somayajulu extern void qls_dump_buf32(qla_host_t *ha, const char *str, void *dbuf,
45711bcba0SDavid C Somayajulu 		uint32_t len32);
46711bcba0SDavid C Somayajulu 
47711bcba0SDavid C Somayajulu extern void qls_dump_cq(qla_host_t *ha);
48711bcba0SDavid C Somayajulu 
49711bcba0SDavid C Somayajulu #ifdef QL_DBG
50711bcba0SDavid C Somayajulu 
51711bcba0SDavid C Somayajulu #define QL_DPRINT1(x)	if (qls_dbg_level & 0x0001) device_printf x
52711bcba0SDavid C Somayajulu #define QL_DPRINT2(x)	if (qls_dbg_level & 0x0002) device_printf x
53711bcba0SDavid C Somayajulu #define QL_DPRINT4(x)	if (qls_dbg_level & 0x0004) device_printf x
54711bcba0SDavid C Somayajulu #define QL_DPRINT8(x)	if (qls_dbg_level & 0x0008) device_printf x
55711bcba0SDavid C Somayajulu #define QL_DPRINT10(x)	if (qls_dbg_level & 0x0010) device_printf x
56711bcba0SDavid C Somayajulu #define QL_DPRINT20(x)	if (qls_dbg_level & 0x0020) device_printf x
57711bcba0SDavid C Somayajulu #define QL_DPRINT40(x)	if (qls_dbg_level & 0x0040) device_printf x
58711bcba0SDavid C Somayajulu #define QL_DPRINT80(x)	if (qls_dbg_level & 0x0080) device_printf x
59711bcba0SDavid C Somayajulu 
60711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER8(h, s, b, n) if (qls_dbg_level & 0x08000000)\
61711bcba0SDavid C Somayajulu 					qls_dump_buf8(h, s, b, n)
62711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER16(h, s, b, n) if (qls_dbg_level & 0x08000000)\
63711bcba0SDavid C Somayajulu 					qls_dump_buf16(h, s, b, n)
64711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER32(h, s, b, n) if (qls_dbg_level & 0x08000000)\
65711bcba0SDavid C Somayajulu 					qls_dump_buf32(h, s, b, n)
66711bcba0SDavid C Somayajulu 
67711bcba0SDavid C Somayajulu #define QL_ASSERT(ha, x, y)	if (!x && !ha->err_inject) panic y
68711bcba0SDavid C Somayajulu 
69711bcba0SDavid C Somayajulu #define QL_DUMP_CQ(ha)		if (qls_dbg_level & 0x08000000) qls_dump_cq(ha)
70711bcba0SDavid C Somayajulu 
71711bcba0SDavid C Somayajulu #else
72711bcba0SDavid C Somayajulu 
73711bcba0SDavid C Somayajulu #define QL_DPRINT1(x)
74711bcba0SDavid C Somayajulu #define QL_DPRINT2(x)
75711bcba0SDavid C Somayajulu #define QL_DPRINT4(x)
76711bcba0SDavid C Somayajulu #define QL_DPRINT8(x)
77711bcba0SDavid C Somayajulu #define QL_DPRINT10(x)
78711bcba0SDavid C Somayajulu #define QL_DPRINT20(x)
79711bcba0SDavid C Somayajulu #define QL_DPRINT40(x)
80711bcba0SDavid C Somayajulu #define QL_DPRINT80(x)
81711bcba0SDavid C Somayajulu 
82711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER8(h, s, b, n)
83711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER16(h, s, b, n)
84711bcba0SDavid C Somayajulu #define QL_DUMP_BUFFER32(h, s, b, n)
85711bcba0SDavid C Somayajulu 
86711bcba0SDavid C Somayajulu #define QL_ASSERT(ha, x, y)
87711bcba0SDavid C Somayajulu 
88711bcba0SDavid C Somayajulu #define QL_DUMP_CQ(ha)
89711bcba0SDavid C Somayajulu 
90711bcba0SDavid C Somayajulu #endif
91711bcba0SDavid C Somayajulu 
92711bcba0SDavid C Somayajulu #endif /* #ifndef _QL_DBG_H_ */
93