xref: /netbsd-src/sys/dev/scsipi/scsipi_debug.h (revision 5aefcfdc06931dd97e76246d2fe0302f7b3fe094)
1 /*	$NetBSD: scsipi_debug.h,v 1.12 1998/02/13 08:28:53 enami Exp $	*/
2 
3 /*
4  * Written by Julian Elischer (julian@tfs.com)
5  */
6 
7 /*
8  * These are the new debug bits.  (Sat Oct  2 12:46:46 WST 1993)
9  * the following DEBUG bits are defined to exist in the flags word of
10  * the scsi_link structure.
11  */
12 #define	SDEV_DB1		0x10	/* scsi commands, errors, data */
13 #define	SDEV_DB2		0x20	/* routine flow tracking */
14 #define	SDEV_DB3		0x40	/* internal to routine flows */
15 #define	SDEV_DB4		0x80	/* level 4 debugging for this dev */
16 
17 /* type, target and LUN we want to debug */
18 #define DEBUGTYPE	BUS_ATAPI
19 #define	DEBUGTARGET	-1		/* -1 = disable. This is the drive
20 					   number for ATAPI */
21 #define	DEBUGLUN	0
22 #define	DEBUGLEVEL	(SDEV_DB1|SDEV_DB2|SDEV_DB3)
23 
24 /*
25  * This is the usual debug macro for use with the above bits
26  */
27 #ifdef SCSIDEBUG
28 #define	SC_DEBUG(sc_link,Level,Printstuff)				\
29 do {									\
30 	if ((sc_link)->flags & (Level)) {				\
31 		sc_link->sc_print_addr(sc_link);			\
32  		printf Printstuff;					\
33 	}								\
34 } while (0)
35 
36 #define	SC_DEBUGN(sc_link,Level,Printstuff) 				\
37 do {									\
38 	if ((sc_link)->flags & (Level)) {				\
39  		printf Printstuff;					\
40 	}								\
41 } while (0)
42 #else
43 #define SC_DEBUG(A,B,C)
44 #define SC_DEBUGN(A,B,C)
45 #endif
46