xref: /illumos-gate/usr/src/uts/common/io/igb/igb_debug.h (revision fa4e188e8e6bc718b1a096b3d1dc046952a69304)
1 /*
2  * CDDL HEADER START
3  *
4  * Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance with the License.
8  *
9  * You can obtain a copy of the license at:
10  *	http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When using or redistributing this file, you may do so under the
15  * License only. No other modification of this header is permitted.
16  *
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 
24 /*
25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms of the CDDL.
27  */
28 
29 #ifndef	_IGB_DEBUG_H
30 #define	_IGB_DEBUG_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 
37 #ifdef DEBUG
38 #define	IGB_DEBUG
39 #endif
40 
41 typedef enum {
42 	IGB_LOG_NONE =	0,
43 	IGB_LOG_ERROR =	1,
44 	IGB_LOG_INFO =	2,
45 	IGB_LOG_TRACE =	4
46 } igb_debug_t;
47 
48 #define	IGB_DEBUGLOG_0(adapter, fmt)	\
49 	igb_log((adapter), (IGB_LOG_INFO), (fmt))
50 #define	IGB_DEBUGLOG_1(adapter, fmt, d1)	\
51 	igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1))
52 #define	IGB_DEBUGLOG_2(adapter, fmt, d1, d2)	\
53 	igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1), (d2))
54 #define	IGB_DEBUGLOG_3(adapter, fmt, d1, d2, d3)	\
55 	igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1), (d2), (d3))
56 
57 #ifdef IGB_DEBUG
58 #define	IGB_DEBUGFUNC(fmt)		igb_log((NULL), (IGB_LOG_TRACE), (fmt))
59 #define	IGB_DEBUG_STAT_COND(val, cond)	if (cond) (val)++
60 #define	IGB_DEBUG_STAT(val)		(val)++
61 #else
62 #define	IGB_DEBUGFUNC(fmt)
63 #define	IGB_DEBUG_STAT_COND(val, cond)
64 #define	IGB_DEBUG_STAT(val)
65 #endif	/* IGB_DEBUG */
66 
67 #define	IGB_STAT(val)		(val)++
68 
69 #ifdef IGB_DEBUG
70 void pci_dump(void *);
71 #endif	/* IGB_DEBUG */
72 
73 void igb_log(void *, igb_debug_t, const char *, ...);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif	/* _IGB_DEBUG_H */
80