1*5779Sxy150489 /*
2*5779Sxy150489 * CDDL HEADER START
3*5779Sxy150489 *
4*5779Sxy150489 * Copyright(c) 2007-2008 Intel Corporation. All rights reserved.
5*5779Sxy150489 * The contents of this file are subject to the terms of the
6*5779Sxy150489 * Common Development and Distribution License (the "License").
7*5779Sxy150489 * You may not use this file except in compliance with the License.
8*5779Sxy150489 *
9*5779Sxy150489 * You can obtain a copy of the license at:
10*5779Sxy150489 * http://www.opensolaris.org/os/licensing.
11*5779Sxy150489 * See the License for the specific language governing permissions
12*5779Sxy150489 * and limitations under the License.
13*5779Sxy150489 *
14*5779Sxy150489 * When using or redistributing this file, you may do so under the
15*5779Sxy150489 * License only. No other modification of this header is permitted.
16*5779Sxy150489 *
17*5779Sxy150489 * If applicable, add the following below this CDDL HEADER, with the
18*5779Sxy150489 * fields enclosed by brackets "[]" replaced with your own identifying
19*5779Sxy150489 * information: Portions Copyright [yyyy] [name of copyright owner]
20*5779Sxy150489 *
21*5779Sxy150489 * CDDL HEADER END
22*5779Sxy150489 */
23*5779Sxy150489
24*5779Sxy150489 /*
25*5779Sxy150489 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
26*5779Sxy150489 * Use is subject to license terms of the CDDL.
27*5779Sxy150489 */
28*5779Sxy150489
29*5779Sxy150489 #pragma ident "%Z%%M% %I% %E% SMI"
30*5779Sxy150489
31*5779Sxy150489 #include "igb_sw.h"
32*5779Sxy150489
33*5779Sxy150489 #define LOG_BUF_LEN 128
34*5779Sxy150489
35*5779Sxy150489 /*
36*5779Sxy150489 * igb_notice - Report a run-time event (CE_NOTE, to console & log)
37*5779Sxy150489 */
38*5779Sxy150489 void
igb_notice(void * arg,const char * fmt,...)39*5779Sxy150489 igb_notice(void *arg, const char *fmt, ...)
40*5779Sxy150489 {
41*5779Sxy150489 igb_t *igbp = (igb_t *)arg;
42*5779Sxy150489 char buf[LOG_BUF_LEN];
43*5779Sxy150489 va_list ap;
44*5779Sxy150489
45*5779Sxy150489 va_start(ap, fmt);
46*5779Sxy150489 (void) vsnprintf(buf, sizeof (buf), fmt, ap);
47*5779Sxy150489 va_end(ap);
48*5779Sxy150489
49*5779Sxy150489 if (igbp != NULL)
50*5779Sxy150489 cmn_err(CE_NOTE, "%s%d: %s", MODULE_NAME, igbp->instance, buf);
51*5779Sxy150489 else
52*5779Sxy150489 cmn_err(CE_NOTE, "%s: %s", MODULE_NAME, buf);
53*5779Sxy150489 }
54*5779Sxy150489
55*5779Sxy150489 /*
56*5779Sxy150489 * igb_log - Log a run-time event (CE_NOTE, to log only)
57*5779Sxy150489 */
58*5779Sxy150489 void
igb_log(void * arg,const char * fmt,...)59*5779Sxy150489 igb_log(void *arg, const char *fmt, ...)
60*5779Sxy150489 {
61*5779Sxy150489 igb_t *igbp = (igb_t *)arg;
62*5779Sxy150489 char buf[LOG_BUF_LEN];
63*5779Sxy150489 va_list ap;
64*5779Sxy150489
65*5779Sxy150489 va_start(ap, fmt);
66*5779Sxy150489 (void) vsnprintf(buf, sizeof (buf), fmt, ap);
67*5779Sxy150489 va_end(ap);
68*5779Sxy150489
69*5779Sxy150489 if (igbp != NULL)
70*5779Sxy150489 cmn_err(CE_NOTE, "!%s%d: %s", MODULE_NAME, igbp->instance, buf);
71*5779Sxy150489 else
72*5779Sxy150489 cmn_err(CE_NOTE, "!%s: %s", MODULE_NAME, buf);
73*5779Sxy150489 }
74*5779Sxy150489
75*5779Sxy150489 /*
76*5779Sxy150489 * igb_error - Log a run-time problem (CE_WARN, to log only)
77*5779Sxy150489 */
78*5779Sxy150489 void
igb_error(void * arg,const char * fmt,...)79*5779Sxy150489 igb_error(void *arg, const char *fmt, ...)
80*5779Sxy150489 {
81*5779Sxy150489 igb_t *igbp = (igb_t *)arg;
82*5779Sxy150489 char buf[LOG_BUF_LEN];
83*5779Sxy150489 va_list ap;
84*5779Sxy150489
85*5779Sxy150489 va_start(ap, fmt);
86*5779Sxy150489 (void) vsnprintf(buf, sizeof (buf), fmt, ap);
87*5779Sxy150489 va_end(ap);
88*5779Sxy150489
89*5779Sxy150489 if (igbp != NULL)
90*5779Sxy150489 cmn_err(CE_WARN, "!%s%d: %s", MODULE_NAME, igbp->instance, buf);
91*5779Sxy150489 else
92*5779Sxy150489 cmn_err(CE_WARN, "!%s: %s", MODULE_NAME, buf);
93*5779Sxy150489 }
94