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