Sync usage with man page.
[netbsd-mini2440.git] / sys / dev / scsipi / scsipi_debug.h
blob6b99f4a49d904856719ac31bd95d8d28eabf0ec4
1 /* $NetBSD: scsipi_debug.h,v 1.16 2005/12/11 12:23:50 christos Exp $ */
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
33 #if defined(_KERNEL_OPT)
34 #include "opt_scsipi_debug.h"
35 #endif
38 * Originally written by Julian Elischer (julian@tfs.com)
41 #define SCSIPI_DB1 0x0001 /* scsi commands, errors, data */
42 #define SCSIPI_DB2 0x0002 /* routine flow tracking */
43 #define SCSIPI_DB3 0x0004 /* internal to routine flows */
44 #define SCSIPI_DB4 0x0008 /* level 4 debugging for this dev */
47 * The following options allow us to build a kernel with debugging on
48 * by default for a certain type of device. We can always enable
49 * debugging on a specific device using an ioctl.
51 #ifndef SCSIPI_DEBUG_TYPE
52 #define SCSIPI_DEBUG_TYPE SCSIPI_BUSTYPE_ATAPI
53 #endif
55 #ifndef SCSIPI_DEBUG_TARGET
56 #define SCSIPI_DEBUG_TARGET -1 /* disabled */
57 #endif
59 #ifndef SCSIPI_DEBUG_LUN
60 #define SCSIPI_DEBUG_LUN 0
61 #endif
64 * Default debugging flags for above.
66 #ifndef SCSIPI_DEBUG_FLAGS
67 #define SCSIPI_DEBUG_FLAGS (SCSIPI_DB1|SCSIPI_DB2|SCSIPI_DB3)
68 #endif
70 #ifdef SCSIPI_DEBUG
71 #define SC_DEBUG(periph, flags, x) \
72 do { \
73 if ((periph)->periph_dbflags & (flags)) { \
74 scsipi_printaddr((periph)); \
75 printf x ; \
76 } \
77 } while (0)
79 #define SC_DEBUGN(periph, flags, x) \
80 do { \
81 if ((periph)->periph_dbflags & (flags)) \
82 printf x ; \
83 } while (0)
84 #else
85 #define SC_DEBUG(periph, flags, x) /* nothing */
86 #define SC_DEBUGN(periph, flags, x) /* nothing */
87 #endif