1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 QLogic Corporation
* The contents of this file are subject to the terms of the
* QLogic End User License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the License at
* http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
* QLogic_End_User_Software_License.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/* This file is included by lmdev/include/debug.h */
#ifndef __BNXE_DEBUG_H__
#define __BNXE_DEBUG_H__
#include <sys/types.h>
#include <sys/cmn_err.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/varargs.h>
#undef u /* see bnxe.h for explanation */
extern char * BnxeDevName(void *);
#ifdef DBG
/********************************************/
/* all DbgXXX() routines are used by the LM */
/********************************************/
/*
* Don't use the __FILE_STRIPPED macro as it will eat up too much read-only
* data and dtrace will fail to load on SPARC. Use __BASENAME__ passed to the
* compiler in the Makefile.
*/
#if 0
#undef __FILE_STRIPPED__
#define __FILE_STRIPPED__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#endif
void DbgMessageFunc(void * pDev,
int level,
char * pFmt,
...);
#define DbgMessageXX(_c, _m, _s, ...) \
DbgMessageFunc(_c, _m, "!%s <0x%08x> %s(%d): " _s, \
BnxeDevName((void *)_c), \
_m, \
__BASENAME__, \
__LINE__, \
##__VA_ARGS__)
#define DbgMessage DbgMessageXX
#define DbgBreak() cmn_err(CE_PANIC, "%s(%d): DbgBreak!", \
__BASENAME__, \
__LINE__)
#define DbgBreakMsg(_s) cmn_err(CE_PANIC, "%s(%d): " _s, \
__BASENAME__, \
__LINE__)
#define DbgBreakIf(_cond) \
if (_cond) \
{ \
cmn_err(CE_PANIC, "%s(%d): Condition Failed! - if ("#_cond")", \
__BASENAME__, \
__LINE__); \
}
#define DbgBreakFastPath() DbgBreak()
#define DbgBreakMsgFastPath(_s) DbgBreakMsg(_s)
#define DbgBreakIfFastPath(_c) DbgBreakIf(_c)
#define dbg_out(_c, _m, _s, _d1) DbgMessageXX(_c, _m, _s, _d1)
#endif /* DBG */
/*****************************************************************/
/* all BnxeDbgXXX() and BnxeLogXXX() routines are used by the UM */
/*****************************************************************/
#define BnxeDbgBreak(_c) cmn_err(CE_PANIC, "%s: %s(%d): DbgBreak!", \
BnxeDevName(_c), \
__BASENAME__, \
__LINE__)
#define BnxeDbgBreakMsg(_c, _s) cmn_err(CE_PANIC, "%s: %s(%d): " _s, \
BnxeDevName(_c), \
__BASENAME__, \
__LINE__)
#define BnxeDbgBreakIf(_c, _cond) \
if (_cond) \
{ \
cmn_err(CE_PANIC, "%s: %s(%d): Condition Failed! - if ("#_cond")", \
BnxeDevName(_c), \
__BASENAME__, \
__LINE__); \
}
#define BnxeDbgBreakFastPath(_c) BnxeDbgBreak(_c)
#define BnxeDbgBreakMsgFastPath(_c, _s) BnxeDbgBreakMsg(_c, _s)
#define BnxeDbgBreakIfFastPath(_c, _cond) BnxeDbgBreakIf(_c, _cond)
void BnxeLogInfo(void * pDev, char * pFmt, ...);
void BnxeLogWarn(void * pDev, char * pFmt, ...);
/* for CE_PANIC use one of the BnxeDbgBreak macros above */
#ifdef DBG
void BnxeLogDbg(void * pDev, char * pFmt, ...);
#else
#define BnxeLogDbg
#endif
#endif /* __BNXE_DEBUG_H__ */
|