1507c3241Smlf /*
2507c3241Smlf  * CDDL HEADER START
3507c3241Smlf  *
4507c3241Smlf  * The contents of this file are subject to the terms of the
5*2d6eb4a5SToomas Soome  * Common Development and Distribution License (the "License").
6507c3241Smlf  * You may not use this file except in compliance with the License.
7507c3241Smlf  *
8507c3241Smlf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9507c3241Smlf  * or http://www.opensolaris.org/os/licensing.
10507c3241Smlf  * See the License for the specific language governing permissions
11507c3241Smlf  * and limitations under the License.
12507c3241Smlf  *
13507c3241Smlf  * When distributing Covered Code, include this CDDL HEADER in each
14507c3241Smlf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15507c3241Smlf  * If applicable, add the following below this CDDL HEADER, with the
16507c3241Smlf  * fields enclosed by brackets "[]" replaced with your own identifying
17507c3241Smlf  * information: Portions Copyright [yyyy] [name of copyright owner]
18507c3241Smlf  *
19507c3241Smlf  * CDDL HEADER END
20507c3241Smlf  */
21507c3241Smlf 
22507c3241Smlf /*
23507c3241Smlf  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
24507c3241Smlf  * Use is subject to license terms.
25507c3241Smlf  */
26507c3241Smlf 
27507c3241Smlf #ifndef _ATA_DEBUG_H
28507c3241Smlf #define	_ATA_DEBUG_H
29507c3241Smlf 
30507c3241Smlf #ifdef	__cplusplus
31507c3241Smlf extern "C" {
32507c3241Smlf #endif
33507c3241Smlf 
34507c3241Smlf /*
35507c3241Smlf  * debugging options
36507c3241Smlf  */
37507c3241Smlf 
38507c3241Smlf /*
39507c3241Smlf  * Always print "real" error messages on non-debugging kernels
40507c3241Smlf  */
41507c3241Smlf 
42507c3241Smlf #ifdef	ATA_DEBUG
43507c3241Smlf #define	ADBG_ERROR(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_ERROR, fmt)
44507c3241Smlf #else
45507c3241Smlf #define	ADBG_ERROR(fmt)	ghd_err fmt
46507c3241Smlf #endif
47507c3241Smlf 
48507c3241Smlf /*
49507c3241Smlf  * ... everything else is conditional on the ATA_DEBUG preprocessor symbol
50507c3241Smlf  */
51507c3241Smlf 
52507c3241Smlf #define	ADBG_WARN(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_WARN, fmt)
53507c3241Smlf #define	ADBG_TRACE(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_TRACE, fmt)
54507c3241Smlf #define	ADBG_INIT(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_INIT, fmt)
55507c3241Smlf #define	ADBG_TRANSPORT(fmt)	ADBG_FLAG_CHK(ADBG_FLAG_TRANSPORT, fmt)
56507c3241Smlf #define	ADBG_DMA(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_DMA, fmt)
57507c3241Smlf #define	ADBG_ARQ(fmt)		ADBG_FLAG_CHK(ADBG_FLAG_ARQ, fmt)
58507c3241Smlf 
59507c3241Smlf 
60507c3241Smlf 
61507c3241Smlf 
62507c3241Smlf extern int ata_debug;
63507c3241Smlf 
64507c3241Smlf #define	ADBG_FLAG_ERROR		0x0001
65507c3241Smlf #define	ADBG_FLAG_WARN		0x0002
66507c3241Smlf #define	ADBG_FLAG_TRACE		0x0004
67507c3241Smlf #define	ADBG_FLAG_INIT		0x0008
68507c3241Smlf #define	ADBG_FLAG_TRANSPORT	0x0010
69507c3241Smlf #define	ADBG_FLAG_DMA		0x0020
70507c3241Smlf #define	ADBG_FLAG_ARQ		0x0040
71507c3241Smlf 
72507c3241Smlf 
73507c3241Smlf 
74507c3241Smlf #ifdef	ATA_DEBUG
75507c3241Smlf #define	ADBG_FLAG_CHK(flag, fmt) if (ata_debug & (flag)) GDBG_PRF(fmt)
76507c3241Smlf #else
77507c3241Smlf #define	ADBG_FLAG_CHK(flag, fmt)
78507c3241Smlf #endif
79507c3241Smlf 
80507c3241Smlf 
81507c3241Smlf 
82507c3241Smlf #ifdef	__cplusplus
83507c3241Smlf }
84507c3241Smlf #endif
85507c3241Smlf 
86507c3241Smlf #endif /* _ATA_DEBUG_H */
87