scsipi_debug.h revision 1.12.14.1 1 1.12.14.1 thorpej /* $NetBSD: scsipi_debug.h,v 1.12.14.1 1999/11/01 22:54:19 thorpej Exp $ */
2 1.12.14.1 thorpej
3 1.12.14.1 thorpej /*-
4 1.12.14.1 thorpej * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 1.12.14.1 thorpej * All rights reserved.
6 1.12.14.1 thorpej *
7 1.12.14.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.12.14.1 thorpej * by by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.12.14.1 thorpej * NASA Ames Research Center.
10 1.12.14.1 thorpej *
11 1.12.14.1 thorpej * Redistribution and use in source and binary forms, with or without
12 1.12.14.1 thorpej * modification, are permitted provided that the following conditions
13 1.12.14.1 thorpej * are met:
14 1.12.14.1 thorpej * 1. Redistributions of source code must retain the above copyright
15 1.12.14.1 thorpej * notice, this list of conditions and the following disclaimer.
16 1.12.14.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
17 1.12.14.1 thorpej * notice, this list of conditions and the following disclaimer in the
18 1.12.14.1 thorpej * documentation and/or other materials provided with the distribution.
19 1.12.14.1 thorpej * 3. All advertising materials mentioning features or use of this software
20 1.12.14.1 thorpej * must display the following acknowledgement:
21 1.12.14.1 thorpej * This product includes software developed by the NetBSD
22 1.12.14.1 thorpej * Foundation, Inc. and its contributors.
23 1.12.14.1 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.12.14.1 thorpej * contributors may be used to endorse or promote products derived
25 1.12.14.1 thorpej * from this software without specific prior written permission.
26 1.12.14.1 thorpej *
27 1.12.14.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.12.14.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.12.14.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.12.14.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.12.14.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.12.14.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.12.14.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.12.14.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.12.14.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.12.14.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.12.14.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
38 1.12.14.1 thorpej */
39 1.12.14.1 thorpej
40 1.12.14.1 thorpej #if defined(_KERNEL) && !defined(_LKM)
41 1.12.14.1 thorpej #include "opt_scsipi_debug.h"
42 1.12.14.1 thorpej #endif
43 1.3 cgd
44 1.1 mycroft /*
45 1.12.14.1 thorpej * Originally written by Julian Elischer (julian (at) tfs.com)
46 1.1 mycroft */
47 1.11 enami
48 1.12.14.1 thorpej #define SCSIPI_DB1 0x0001 /* scsi commands, errors, data */
49 1.12.14.1 thorpej #define SCSIPI_DB2 0x0002 /* routine flow tracking */
50 1.12.14.1 thorpej #define SCSIPI_DB3 0x0004 /* internal to routine flows */
51 1.12.14.1 thorpej #define SCSIPI_DB4 0x0008 /* level 4 debugging for this dev */
52 1.12.14.1 thorpej
53 1.1 mycroft /*
54 1.12.14.1 thorpej * The following options allow us to build a kernel with debugging on
55 1.12.14.1 thorpej * by default for a certain type of device. We can always enable
56 1.12.14.1 thorpej * debugging on a specific device using an ioctl.
57 1.1 mycroft */
58 1.12.14.1 thorpej #ifndef SCSIPI_DEBUG_TYPE
59 1.12.14.1 thorpej #define SCSIPI_DEBUG_TYPE SCSIPI_BUSTYPE_ATAPI
60 1.12.14.1 thorpej #endif
61 1.12.14.1 thorpej
62 1.12.14.1 thorpej #ifndef SCSIPI_DEBUG_TARGET
63 1.12.14.1 thorpej #define SCSIPI_DEBUG_TARGET -1 /* disabled */
64 1.12.14.1 thorpej #endif
65 1.12.14.1 thorpej
66 1.12.14.1 thorpej #ifndef SCSIPI_DEBUG_LUN
67 1.12.14.1 thorpej #define SCSIPI_DEBUG_LUN 0
68 1.12.14.1 thorpej #endif
69 1.12.14.1 thorpej
70 1.1 mycroft /*
71 1.12.14.1 thorpej * Default debugging flags for above.
72 1.1 mycroft */
73 1.12.14.1 thorpej #ifndef SCSIPI_DEBUG_FLAGS
74 1.12.14.1 thorpej #define SCSIPI_DEBUG_FLAGS (SCSIPI_DB1|SCSIPI_DB2|SCSIPI_DB3)
75 1.12.14.1 thorpej #endif
76 1.12.14.1 thorpej
77 1.12.14.1 thorpej #ifdef SCSIPI_DEBUG
78 1.12.14.1 thorpej #define SC_DEBUG(periph, flags, x) \
79 1.8 bouyer do { \
80 1.12.14.1 thorpej if ((periph)->periph_dbflags & (flags)) { \
81 1.12.14.1 thorpej scsipi_printaddr((periph)); \
82 1.12.14.1 thorpej printf x ; \
83 1.8 bouyer } \
84 1.10 christos } while (0)
85 1.8 bouyer
86 1.12.14.1 thorpej #define SC_DEBUGN(periph, flags, x) \
87 1.8 bouyer do { \
88 1.12.14.1 thorpej if ((periph)->periph_dbflags & (flags)) \
89 1.12.14.1 thorpej printf x ; \
90 1.10 christos } while (0)
91 1.1 mycroft #else
92 1.12.14.1 thorpej #define SC_DEBUG(periph, flags, x) /* nothing */
93 1.12.14.1 thorpej #define SC_DEBUGN(periph, flags, x) /* nothing */
94 1.1 mycroft #endif
95