4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014 QLogic Corporation
24 * The contents of this file are subject to the terms of the
25 * QLogic End User License (the "License").
26 * You may not use this file except in compliance with the License.
28 * You can obtain a copy of the License at
29 * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
30 * QLogic_End_User_Software_License.txt
31 * See the License for the specific language governing permissions
32 * and limitations under the License.
35 /* This file is included by lmdev/include/debug.h */
37 #ifndef __BNXE_DEBUG_H__
38 #define __BNXE_DEBUG_H__
40 #include <sys/types.h>
41 #include <sys/cmn_err.h>
43 #include <sys/sunddi.h>
44 #include <sys/varargs.h>
45 #undef u /* see bnxe.h for explanation */
47 extern char * BnxeDevName(void *);
52 /********************************************/
53 /* all DbgXXX() routines are used by the LM */
54 /********************************************/
57 * Don't use the __FILE_STRIPPED macro as it will eat up too much read-only
58 * data and dtrace will fail to load on SPARC. Use __BASENAME__ passed to the
59 * compiler in the Makefile.
62 #undef __FILE_STRIPPED__
63 #define __FILE_STRIPPED__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
66 void DbgMessageFunc(void * pDev
,
71 #define DbgMessageXX(_c, _m, _s, ...) \
72 DbgMessageFunc(_c, _m, "!%s <0x%08x> %s(%d): " _s, \
73 BnxeDevName((void *)_c), \
79 #define DbgMessage DbgMessageXX
81 #define DbgBreak() cmn_err(CE_PANIC, "%s(%d): DbgBreak!", \
85 #define DbgBreakMsg(_s) cmn_err(CE_PANIC, "%s(%d): " _s, \
89 #define DbgBreakIf(_cond) \
92 cmn_err(CE_PANIC, "%s(%d): Condition Failed! - if ("#_cond")", \
97 #define DbgBreakFastPath() DbgBreak()
98 #define DbgBreakMsgFastPath(_s) DbgBreakMsg(_s)
99 #define DbgBreakIfFastPath(_c) DbgBreakIf(_c)
101 #define dbg_out(_c, _m, _s, _d1) DbgMessageXX(_c, _m, _s, _d1)
106 /*****************************************************************/
107 /* all BnxeDbgXXX() and BnxeLogXXX() routines are used by the UM */
108 /*****************************************************************/
110 #define BnxeDbgBreak(_c) cmn_err(CE_PANIC, "%s: %s(%d): DbgBreak!", \
115 #define BnxeDbgBreakMsg(_c, _s) cmn_err(CE_PANIC, "%s: %s(%d): " _s, \
120 #define BnxeDbgBreakIf(_c, _cond) \
123 cmn_err(CE_PANIC, "%s: %s(%d): Condition Failed! - if ("#_cond")", \
129 #define BnxeDbgBreakFastPath(_c) BnxeDbgBreak(_c)
130 #define BnxeDbgBreakMsgFastPath(_c, _s) BnxeDbgBreakMsg(_c, _s)
131 #define BnxeDbgBreakIfFastPath(_c, _cond) BnxeDbgBreakIf(_c, _cond)
133 void BnxeLogInfo(void * pDev
, char * pFmt
, ...);
134 void BnxeLogWarn(void * pDev
, char * pFmt
, ...);
135 /* for CE_PANIC use one of the BnxeDbgBreak macros above */
138 void BnxeLogDbg(void * pDev
, char * pFmt
, ...);
143 #endif /* __BNXE_DEBUG_H__ */