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