xref: /titanic_41/usr/src/uts/common/sys/fibre-channel/fca/qlge/qlge_dbg.h (revision accf27a5824ae84dfac7b089c4325917231a7d15)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 QLogic Corporation. All rights reserved.
24  */
25 
26 #ifndef _QLGE_DBG_H
27 #define	_QLGE_DBG_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Driver debug definitions in makefile.
35  */
36 
37 #define	QL_DEBUG_LEVELS 0x2
38 
39 #define	DBG_NVRAM	0x01	/* Registers, PCI */
40 #define	DBG_INIT 	0x02
41 #define	DBG_GLD 	0x04
42 #define	DBG_MBX		0x08
43 #define	DBG_FLASH	0x08
44 #define	DBG_RX 		0x10
45 #define	DBG_RX_RING	0x20
46 #define	DBG_TX 		0x40
47 #define	DBG_STATS 	0x80
48 #define	DBG_INTR	0x100
49 
50 #ifdef QL_DUMPFW
51 #define	QLA_CORE_DUMP(qlge)		ql_core_dump(qlge);
52 #define	QLA_DUMP_CRASH_RECORD(qlge)	ql_dump_crash_record(qlge)
53 #else
54 #define	QLA_CORE_DUMP(qlge)
55 #define	QLA_DUMP_CRASH_RECORD(qlge)
56 #endif
57 
58 #if QL_DEBUG
59 
60 #define	QL_DUMP_BUFFER(a, b, c, d) \
61 	ql_dump_buf((char *)a, (uint8_t *)b, (uint8_t)c, (uint32_t)d)
62 
63 #define	QL_PRINT_1(x)		ql_printf x
64 
65 #define	QL_PRINT(dbg_level, x) \
66 		if (qlge->ql_dbgprnt & dbg_level) ql_printf x
67 #define	QL_DUMP(dbg_level, a, b, c, d)	\
68 		if (qlge->ql_dbgprnt & dbg_level) QL_DUMP_BUFFER(a, b, c, d)
69 
70 #define	QL_DUMP_REQ_PKT(qlge, pkt, oal, num)	if (qlge->ql_dbgprnt & DBG_TX) \
71 					ql_dump_req_pkt(qlge, pkt, oal, num)
72 
73 #define	QL_DUMP_CQICB(qlge, cqicb) if (qlge->ql_dbgprnt & DBG_INIT) \
74 					ql_dump_cqicb(qlge, cqicb)
75 
76 #define	QL_DUMP_WQICB(qlge, wqicb) if (qlge->ql_dbgprnt & DBG_INIT) \
77 					ql_dump_wqicb(qlge, wqicb)
78 
79 #else
80 
81 #define	QLA_HOST_PCI_REGS(qlge)
82 
83 #define	QL_DUMP_BUFFER(a, b, c, d)
84 #define	QL_DUMP(dbg_level, a, b, c, d)
85 #define	QL_DEBUG_PRINT(x)
86 #define	QL_PRINT(dbg_level, x)
87 #define	QL_DUMP_REQ_PKT(qlge, pkt, oal, num)
88 #define	QL_DUMP_CQICB
89 #define	QL_DUMP_WQICB
90 
91 #endif	/* QLGE_DEBUG */
92 
93 /*
94  * Error and Extended Logging Macros.
95  */
96 #define	QL_BANG		"!"
97 #define	QL_QUESTION	"?"
98 #define	QL_CAROT	"^"
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* _QLGE_DBG_H */
105