xref: /titanic_44/usr/src/uts/common/io/ixgbe/ixgbe_debug.h (revision b7a756257cd6b540ba759f01a8056d13a3139eed)
19da57d7bSbt150084 /*
29da57d7bSbt150084  * CDDL HEADER START
39da57d7bSbt150084  *
419843f01SPaul Guo  * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
59da57d7bSbt150084  * The contents of this file are subject to the terms of the
69da57d7bSbt150084  * Common Development and Distribution License (the "License").
79da57d7bSbt150084  * You may not use this file except in compliance with the License.
89da57d7bSbt150084  *
99da57d7bSbt150084  * You can obtain a copy of the license at:
109da57d7bSbt150084  *      http://www.opensolaris.org/os/licensing.
119da57d7bSbt150084  * See the License for the specific language governing permissions
129da57d7bSbt150084  * and limitations under the License.
139da57d7bSbt150084  *
149da57d7bSbt150084  * When using or redistributing this file, you may do so under the
159da57d7bSbt150084  * License only. No other modification of this header is permitted.
169da57d7bSbt150084  *
179da57d7bSbt150084  * If applicable, add the following below this CDDL HEADER, with the
189da57d7bSbt150084  * fields enclosed by brackets "[]" replaced with your own identifying
199da57d7bSbt150084  * information: Portions Copyright [yyyy] [name of copyright owner]
209da57d7bSbt150084  *
219da57d7bSbt150084  * CDDL HEADER END
229da57d7bSbt150084  */
239da57d7bSbt150084 
249da57d7bSbt150084 /*
2519843f01SPaul Guo  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
2673cd555cSBin Tu - Sun Microsystems - Beijing China  * Use is subject to license terms.
279da57d7bSbt150084  */
289da57d7bSbt150084 
29313ba796SDale Ghent /*
30313ba796SDale Ghent  * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
31*b7a75625SRyan Zezeski  * Copyright 2017 Joyent, Inc.
32313ba796SDale Ghent  */
33313ba796SDale Ghent 
349da57d7bSbt150084 #ifndef	_IXGBE_DEBUG_H
359da57d7bSbt150084 #define	_IXGBE_DEBUG_H
369da57d7bSbt150084 
379da57d7bSbt150084 #ifdef __cplusplus
389da57d7bSbt150084 extern "C" {
399da57d7bSbt150084 #endif
409da57d7bSbt150084 
419da57d7bSbt150084 
429da57d7bSbt150084 #ifdef DEBUG
439da57d7bSbt150084 #define	IXGBE_DEBUG
449da57d7bSbt150084 #endif
459da57d7bSbt150084 
469da57d7bSbt150084 #ifdef IXGBE_DEBUG
479da57d7bSbt150084 
489da57d7bSbt150084 #define	IXGBE_DEBUGLOG_0(adapter, fmt)	\
499da57d7bSbt150084 	ixgbe_log((adapter), (fmt))
509da57d7bSbt150084 #define	IXGBE_DEBUGLOG_1(adapter, fmt, d1)	\
519da57d7bSbt150084 	ixgbe_log((adapter), (fmt), (d1))
529da57d7bSbt150084 #define	IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2)	\
539da57d7bSbt150084 	ixgbe_log((adapter), (fmt), (d1), (d2))
549da57d7bSbt150084 #define	IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3)	\
559da57d7bSbt150084 	ixgbe_log((adapter), (fmt), (d1), (d2), (d3))
569da57d7bSbt150084 #define	IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6)	\
579da57d7bSbt150084 	ixgbe_log((adapter), (fmt), (d1), (d2), (d3), (d4), (d5), (d6))
589da57d7bSbt150084 
599da57d7bSbt150084 #else
609da57d7bSbt150084 
619da57d7bSbt150084 #define	IXGBE_DEBUGLOG_0(adapter, fmt)
629da57d7bSbt150084 #define	IXGBE_DEBUGLOG_1(adapter, fmt, d1)
639da57d7bSbt150084 #define	IXGBE_DEBUGLOG_2(adapter, fmt, d1, d2)
649da57d7bSbt150084 #define	IXGBE_DEBUGLOG_3(adapter, fmt, d1, d2, d3)
659da57d7bSbt150084 #define	IXGBE_DEBUGLOG_6(adapter, fmt, d1, d2, d3, d4, d5, d6)
669da57d7bSbt150084 
679da57d7bSbt150084 #endif	/* IXGBE_DEBUG */
689da57d7bSbt150084 
699da57d7bSbt150084 #ifdef IXGBE_DEBUG
709da57d7bSbt150084 void ixgbe_pci_dump(void *);
719da57d7bSbt150084 void ixgbe_dump_interrupt(void *, char *);
729da57d7bSbt150084 void ixgbe_dump_addr(void *, char *, const uint8_t *);
739da57d7bSbt150084 
7473cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT(S)	\
7573cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_0(NULL, S)
7673cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT1(S, A)	\
7773cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_1(NULL, S, A)
7873cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT2(S, A, B)	\
7973cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_2(NULL, S, A, B)
8073cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT3(S, A, B, C)	\
8173cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_3(NULL, S, A, B, C)
8273cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT6(S, A, B, C, D, E, F)	\
8373cd555cSBin Tu - Sun Microsystems - Beijing China 	IXGBE_DEBUGLOG_6(NULL, S, A, B, C, D, E, F)
8473cd555cSBin Tu - Sun Microsystems - Beijing China 
85313ba796SDale Ghent #define	IXGBE_ERROR_INVALID_STATE	"INVALID STATE"
86313ba796SDale Ghent #define	IXGBE_ERROR_POLLING		"POLLING ERROR"
87313ba796SDale Ghent #define	IXGBE_ERROR_CAUTION		"CAUTION"
88313ba796SDale Ghent #define	IXGBE_ERROR_SOFTWARE		"SOFTWARE ERROR"
89313ba796SDale Ghent #define	IXGBE_ERROR_ARGUMENT		"BAD ARGUMENT"
90313ba796SDale Ghent #define	IXGBE_ERROR_UNSUPPORTED		"UNSUPPORTED"
91313ba796SDale Ghent 
92313ba796SDale Ghent #define	ERROR_REPORT1(S, A)		DEBUGOUT(S ":" A)
93313ba796SDale Ghent #define	ERROR_REPORT2(S, A, B)		DEBUGOUT1(S ":" A, B)
94313ba796SDale Ghent #define	ERROR_REPORT3(S, A, B, C)	DEBUGOUT2(S ":" A, B, C)
9573cd555cSBin Tu - Sun Microsystems - Beijing China 
9673cd555cSBin Tu - Sun Microsystems - Beijing China #else
9773cd555cSBin Tu - Sun Microsystems - Beijing China 
9873cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT(S)
9973cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT1(S, A)
10073cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT2(S, A, B)
10173cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT3(S, A, B, C)
10273cd555cSBin Tu - Sun Microsystems - Beijing China #define	DEBUGOUT6(S, A, B, C, D, E, F)
10373cd555cSBin Tu - Sun Microsystems - Beijing China 
104313ba796SDale Ghent #define	ERROR_REPORT1(S, A)
105313ba796SDale Ghent #define	ERROR_REPORT2(S, A, B)
106313ba796SDale Ghent #define	ERROR_REPORT3(S, A, B, C)
10773cd555cSBin Tu - Sun Microsystems - Beijing China 
10873cd555cSBin Tu - Sun Microsystems - Beijing China #endif	/* IXGBE_DEBUG */
10973cd555cSBin Tu - Sun Microsystems - Beijing China 
110313ba796SDale Ghent /*
111313ba796SDale Ghent  * DEBUGFUNC() is used to print the function call information, however since
112313ba796SDale Ghent  * DTrace in illumos can be used to trace function calls, this function is
113313ba796SDale Ghent  * not useful in illumos, and DEBUGFUNC() can spam a large number of
114313ba796SDale Ghent  * function call system logs (see CR6918426). We sould eliminate
115313ba796SDale Ghent  * DEBUGFUNC(), but since DEBUGFUNC() is used by the shared code
116313ba796SDale Ghent  * (maintained by Intel) which is used and shared by ixgbe drivers in
117313ba796SDale Ghent  * different OSes, we can not remove it, so in illumos just simply define
118313ba796SDale Ghent  * it as blank.
119313ba796SDale Ghent  */
120313ba796SDale Ghent #define	DEBUGFUNC(F)
121313ba796SDale Ghent 
1229da57d7bSbt150084 extern void ixgbe_log(void *, const char *, ...);
1239da57d7bSbt150084 
1249da57d7bSbt150084 #ifdef __cplusplus
1259da57d7bSbt150084 }
1269da57d7bSbt150084 #endif
1279da57d7bSbt150084 
1289da57d7bSbt150084 #endif	/* _IXGBE_DEBUG_H */
129