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.
37 #define BNXE_LOG_LEN 256
42 void DbgMessageFunc(void * pDev
,
47 um_device_t
* pUM
= (um_device_t
*)pDev
;
52 (((pUM
->devParams
.debug_level
& level
& CP_ALL
) != (level
& CP_ALL
)) ||
53 ((pUM
->devParams
.debug_level
& LV_MASK
) < (level
& LV_MASK
))))
58 ce
= (((level
& LV_VERBOSE
) == LV_VERBOSE
) ? CE_NOTE
:
59 ((level
& LV_INFORM
) == LV_INFORM
) ? CE_NOTE
:
60 ((level
& LV_WARN
) == LV_WARN
) ? CE_WARN
:
64 vcmn_err(ce
, pFmt
, argp
);
71 void elink_cb_dbg(struct elink_dev
* bp
, char * fmt
)
73 um_device_t
* pUM
= (um_device_t
*)bp
;
74 char buf
[BNXE_LOG_LEN
];
77 if ((pUM
->devParams
.debug_level
& LV_MASK
) < LV_WARN
)
82 snprintf(buf
, sizeof(buf
), fmt
);
83 cmn_err(CE_NOTE
, "!%s: ELINK %s", BnxeDevName(pUM
), buf
);
88 void elink_cb_dbg1(struct elink_dev
* bp
, char * fmt
, u32 arg1
)
90 um_device_t
* pUM
= (um_device_t
*)bp
;
91 char buf
[BNXE_LOG_LEN
];
94 if ((pUM
->devParams
.debug_level
& LV_MASK
) < LV_WARN
)
99 snprintf(buf
, sizeof(buf
), fmt
, arg1
);
100 cmn_err(CE_NOTE
, "!%s: ELINK %s", BnxeDevName(pUM
), buf
);
105 void elink_cb_dbg2(struct elink_dev
* bp
, char * fmt
, u32 arg1
, u32 arg2
)
107 um_device_t
* pUM
= (um_device_t
*)bp
;
108 char buf
[BNXE_LOG_LEN
];
111 if ((pUM
->devParams
.debug_level
& LV_MASK
) < LV_WARN
)
116 snprintf(buf
, sizeof(buf
), fmt
, arg1
, arg2
);
117 cmn_err(CE_NOTE
, "!%s: ELINK %s", BnxeDevName(pUM
), buf
);
122 void elink_cb_dbg3(struct elink_dev
* bp
, char * fmt
, u32 arg1
, u32 arg2
, u32 arg3
)
124 um_device_t
* pUM
= (um_device_t
*)bp
;
125 char buf
[BNXE_LOG_LEN
];
128 if ((pUM
->devParams
.debug_level
& LV_MASK
) < LV_WARN
)
133 snprintf(buf
, sizeof(buf
), fmt
, arg1
, arg2
, arg3
);
134 cmn_err(CE_NOTE
, "!%s: ELINK %s", BnxeDevName(pUM
), buf
);
139 void BnxeLogInfo(void * pDev
,
143 um_device_t
* pUM
= (um_device_t
*)pDev
;
144 char buf
[BNXE_LOG_LEN
];
148 * Info message are logged to syslog only if logEnable is
149 * turned on. They are never logged to the console. If
150 * pUM is NULL then the log is allowed through as if logEnable
154 if (pUM
&& !pUM
->devParams
.logEnable
)
158 /* if !pUM then let the log through */
160 va_start(argp
, pFmt
);
161 vsnprintf(buf
, sizeof(buf
), pFmt
, argp
);
164 cmn_err(CE_NOTE
, "!%s: %s", BnxeDevName(pUM
), buf
);
168 void BnxeLogWarn(void * pDev
,
172 um_device_t
* pUM
= (um_device_t
*)pDev
;
173 char buf
[BNXE_LOG_LEN
];
177 * Warning message are always logged to syslog. They are
178 * never logged to the console.
181 va_start(argp
, pFmt
);
182 vsnprintf(buf
, sizeof(buf
), pFmt
, argp
);
185 cmn_err(CE_WARN
, "!%s: %s", BnxeDevName(pUM
), buf
);
191 void BnxeLogDbg(void * pDev
,
195 um_device_t
* pUM
= (um_device_t
*)pDev
;
196 char buf
[BNXE_LOG_LEN
];
200 * Debug message are always logged to syslog. They are
201 * never logged to the console. Debug messages are only
202 * available when the DEBUG compile time flag is turned on.
205 va_start(argp
, pFmt
);
206 vsnprintf(buf
, sizeof(buf
), pFmt
, argp
);
209 cmn_err(CE_WARN
, "!%s: %s", BnxeDevName(pUM
), buf
);
215 void BnxeDumpMem(um_device_t
* pUM
,
224 mutex_enter(&bnxeLoaderMutex
);
226 cmn_err(CE_WARN
, "!%s ++++++++++++ %s", BnxeDevName(pUM
), pTag
);
227 strcpy(buf
, "!** 000: ");
229 for (xx
= 0; xx
< len
; xx
++)
231 if ((xx
!= 0) && (xx
% 16 == 0))
233 cmn_err(CE_WARN
, buf
);
235 snprintf(c
, sizeof(c
), "%03x", xx
);
240 snprintf(c
, sizeof(c
), "%02x ", *pMem
);
246 cmn_err(CE_WARN
, buf
);
247 cmn_err(CE_WARN
, "!%s ------------ %s", BnxeDevName(pUM
), pTag
);
249 mutex_exit(&bnxeLoaderMutex
);
253 void BnxeDumpPkt(um_device_t
* pUM
,
263 mutex_enter(&bnxeLoaderMutex
);
265 cmn_err(CE_WARN
, "!%s ++++++++++++ %s", BnxeDevName(pUM
), pTag
);
269 pMem
= pMblk
->b_rptr
;
270 strcpy(buf
, "!** > ");
271 snprintf(c
, sizeof(c
), "%03x", xx
);
277 for (i
= 0; i
< MBLKL(pMblk
); i
++)
279 if ((xx
!= 0) && (xx
% 16 == 0))
281 cmn_err(CE_WARN
, buf
);
283 snprintf(c
, sizeof(c
), "%03x", xx
);
288 snprintf(c
, sizeof(c
), "%02x ", *pMem
);
297 snprintf(c
, sizeof(c
), "%d", (int)MBLKL(pMblk
));
302 cmn_err(CE_WARN
, buf
);
303 pMblk
= pMblk
->b_cont
;
306 cmn_err(CE_WARN
, "!%s ------------ %s", BnxeDevName(pUM
), pTag
);
308 mutex_exit(&bnxeLoaderMutex
);