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