14856 cmn_err(9F) missing vdev_err()
[illumos-gate.git] / usr / src / uts / common / io / bnxe / bnxe_debug.h
blob8e41a77c51982e789b72cea02666d5818afcc998
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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>
42 #include <sys/ddi.h>
43 #include <sys/sunddi.h>
44 #include <sys/varargs.h>
45 #undef u /* see bnxe.h for explanation */
47 extern char * BnxeDevName(void *);
50 #ifdef DBG
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.
61 #if 0
62 #undef __FILE_STRIPPED__
63 #define __FILE_STRIPPED__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
64 #endif
66 void DbgMessageFunc(void * pDev,
67 int level,
68 char * pFmt,
69 ...);
71 #define DbgMessageXX(_c, _m, _s, ...) \
72 DbgMessageFunc(_c, _m, "!%s <0x%08x> %s(%d): " _s, \
73 BnxeDevName((void *)_c), \
74 _m, \
75 __BASENAME__, \
76 __LINE__, \
77 ##__VA_ARGS__)
79 #define DbgMessage DbgMessageXX
81 #define DbgBreak() cmn_err(CE_PANIC, "%s(%d): DbgBreak!", \
82 __BASENAME__, \
83 __LINE__)
85 #define DbgBreakMsg(_s) cmn_err(CE_PANIC, "%s(%d): " _s, \
86 __BASENAME__, \
87 __LINE__)
89 #define DbgBreakIf(_cond) \
90 if (_cond) \
91 { \
92 cmn_err(CE_PANIC, "%s(%d): Condition Failed! - if ("#_cond")", \
93 __BASENAME__, \
94 __LINE__); \
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)
103 #endif /* DBG */
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!", \
111 BnxeDevName(_c), \
112 __BASENAME__, \
113 __LINE__)
115 #define BnxeDbgBreakMsg(_c, _s) cmn_err(CE_PANIC, "%s: %s(%d): " _s, \
116 BnxeDevName(_c), \
117 __BASENAME__, \
118 __LINE__)
120 #define BnxeDbgBreakIf(_c, _cond) \
121 if (_cond) \
123 cmn_err(CE_PANIC, "%s: %s(%d): Condition Failed! - if ("#_cond")", \
124 BnxeDevName(_c), \
125 __BASENAME__, \
126 __LINE__); \
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 */
137 #ifdef DBG
138 void BnxeLogDbg(void * pDev, char * pFmt, ...);
139 #else
140 #define BnxeLogDbg
141 #endif
143 #endif /* __BNXE_DEBUG_H__ */