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