Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / uts / common / crypto / io / dca_debug.c
blob7e662630a2b1dfbc47a229da1bfced91faa91c05
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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * Deimos - cryptographic acceleration based upon Broadcom 582x.
33 #include <sys/types.h>
34 #include <sys/ddi.h>
35 #include <sys/sunddi.h>
36 #include <sys/cmn_err.h>
37 #include <sys/varargs.h>
38 #include <sys/crypto/dca.h>
41 * Debugging and messaging.
43 #if DEBUG
44 static int dca_debug = 0;
46 void
47 dca_dprintf(dca_t *dca, int level, const char *fmt, ...)
49 va_list ap;
50 char buf[256];
52 if (dca_debug & level) {
53 va_start(ap, fmt);
54 if (dca == NULL) {
55 (void) sprintf(buf, "%s\n", fmt);
56 } else {
57 (void) sprintf(buf, "%s/%d: %s\n",
58 ddi_driver_name(dca->dca_dip),
59 ddi_get_instance(dca->dca_dip), fmt);
61 vprintf(buf, ap);
62 va_end(ap);
65 #endif
67 void
68 dca_error(dca_t *dca, const char *fmt, ...)
70 va_list ap;
71 va_start(ap, fmt);
72 dca_dipverror(dca->dca_dip, fmt, ap);
73 va_end(ap);
76 void
77 dca_diperror(dev_info_t *dip, const char *fmt, ...)
79 va_list ap;
80 va_start(ap, fmt);
81 dca_dipverror(dip, fmt, ap);
82 va_end(ap);
85 void
86 dca_dipverror(dev_info_t *dip, const char *fmt, va_list ap)
88 char buf[256];
89 (void) sprintf(buf, "%s%d: %s", ddi_driver_name(dip),
90 ddi_get_instance(dip), fmt);
91 vcmn_err(CE_WARN, buf, ap);