19da57d7bSbt /*
29da57d7bSbt  * CDDL HEADER START
39da57d7bSbt  *
4*73cd555cSBin Tu - Sun Microsystems - Beijing China  * Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
59da57d7bSbt  * The contents of this file are subject to the terms of the
69da57d7bSbt  * Common Development and Distribution License (the "License").
79da57d7bSbt  * You may not use this file except in compliance with the License.
89da57d7bSbt  *
99da57d7bSbt  * You can obtain a copy of the license at:
109da57d7bSbt  *      http://www.opensolaris.org/os/licensing.
119da57d7bSbt  * See the License for the specific language governing permissions
129da57d7bSbt  * and limitations under the License.
139da57d7bSbt  *
149da57d7bSbt  * When using or redistributing this file, you may do so under the
159da57d7bSbt  * License only. No other modification of this header is permitted.
169da57d7bSbt  *
179da57d7bSbt  * If applicable, add the following below this CDDL HEADER, with the
189da57d7bSbt  * fields enclosed by brackets "[]" replaced with your own identifying
199da57d7bSbt  * information: Portions Copyright [yyyy] [name of copyright owner]
209da57d7bSbt  *
219da57d7bSbt  * CDDL HEADER END
229da57d7bSbt  */
239da57d7bSbt 
249da57d7bSbt /*
25*73cd555cSBin Tu - Sun Microsystems - Beijing China  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26*73cd555cSBin Tu - Sun Microsystems - Beijing China  * Use is subject to license terms.
279da57d7bSbt  */
289da57d7bSbt 
299da57d7bSbt #ifndef	_IXGBE_DEBUG_H
309da57d7bSbt #define	_IXGBE_DEBUG_H
319da57d7bSbt 
329da57d7bSbt #ifdef __cplusplus
339da57d7bSbt extern "C" {
349da57d7bSbt #endif
359da57d7bSbt 
369da57d7bSbt 
379da57d7bSbt #ifdef DEBUG
389da57d7bSbt #define	IXGBE_DEBUG
399da57d7bSbt #endif
409da57d7bSbt 
419da57d7bSbt #ifdef IXGBE_DEBUG
429da57d7bSbt 
439da57d7bSbt #define	IXGBE_DEBUGLOG_0(adapter, fmt)	\
449da57d7bSbt 	ixgbe_log((adapter), (fmt))
459da57d7bSbt #define	IXGBE_DEBUGLOG_1(adapter, fmt, d1)	\
469da57d7bSbt 	ixgbe_log((adapter), (fmt), (d1))
479da57d7bSbt #define	IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2)	\
489da57d7bSbt 	ixgbe_log((adapter), (fmt), (d1), (d2))
499da57d7bSbt #define	IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3)	\
509da57d7bSbt 	ixgbe_log((adapter), (fmt), (d1), (d2), (d3))
519da57d7bSbt #define	IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6)	\
529da57d7bSbt 	ixgbe_log((adapter), (fmt), (d1), (d2), (d3), (d4), (d5), (d6))
539da57d7bSbt 
549da57d7bSbt #define	IXGBE_DEBUG_STAT_COND(val, cond)	if (cond) (val)++;
559da57d7bSbt #define	IXGBE_DEBUG_STAT(val)		(val)++;
569da57d7bSbt 
579da57d7bSbt #else
589da57d7bSbt 
599da57d7bSbt #define	IXGBE_DEBUGLOG_0(adapter, fmt)
609da57d7bSbt #define	IXGBE_DEBUGLOG_1(adapter, fmt, d1)
619da57d7bSbt #define	IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2)
629da57d7bSbt #define	IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3)
639da57d7bSbt #define	IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6)
649da57d7bSbt 
659da57d7bSbt #define	IXGBE_DEBUG_STAT_COND(val, cond)
669da57d7bSbt #define	IXGBE_DEBUG_STAT(val)
679da57d7bSbt 
689da57d7bSbt #endif	/* IXGBE_DEBUG */
699da57d7bSbt 
709da57d7bSbt #define	IXGBE_STAT(val)		(val)++;
719da57d7bSbt 
729da57d7bSbt #ifdef IXGBE_DEBUG
739da57d7bSbt 
749da57d7bSbt void ixgbe_pci_dump(void *);
759da57d7bSbt void ixgbe_dump_interrupt(void *, char *);
769da57d7bSbt void ixgbe_dump_addr(void *, char *, const uint8_t *);
779da57d7bSbt 
789da57d7bSbt #endif	/* IXGBE_DEBUG */
799da57d7bSbt 
80*73cd555cSBin Tu - Sun Microsystems - Beijing China #ifdef IXGBE_DEBUG
81*73cd555cSBin Tu - Sun Microsystems - Beijing China 
82*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT(S)	\
83*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_0(NULL, S)
84*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT1(S, A)	\
85*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_1(NULL, S, A)
86*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT2(S, A, B)	\
87*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_2(NULL, S, A, B)
88*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT3(S, A, B, C)	\
89*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_3(NULL, S, A, B, C)
90*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT6(S, A, B, C, D, E, F)	\
91*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_6(NULL, S, A, B, C, D, E, F)
92*73cd555cSBin Tu - Sun Microsystems - Beijing China 
93*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGFUNC(F)	\
94*73cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_0(NULL, F)
95*73cd555cSBin Tu - Sun Microsystems - Beijing China 
96*73cd555cSBin Tu - Sun Microsystems - Beijing China #else
97*73cd555cSBin Tu - Sun Microsystems - Beijing China 
98*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT(S)
99*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT1(S, A)
100*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT2(S, A, B)
101*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT3(S, A, B, C)
102*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT6(S, A, B, C, D, E, F)
103*73cd555cSBin Tu - Sun Microsystems - Beijing China 
104*73cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGFUNC(F)
105*73cd555cSBin Tu - Sun Microsystems - Beijing China 
106*73cd555cSBin Tu - Sun Microsystems - Beijing China #endif	/* IXGBE_DEBUG */
107*73cd555cSBin Tu - Sun Microsystems - Beijing China 
1089da57d7bSbt extern void ixgbe_log(void *, const char *, ...);
1099da57d7bSbt 
1109da57d7bSbt #ifdef __cplusplus
1119da57d7bSbt }
1129da57d7bSbt #endif
1139da57d7bSbt 
1149da57d7bSbt #endif	/* _IXGBE_DEBUG_H */
115