xref: /openbsd-src/sys/scsi/scsi_debug.h (revision c90a81c56dcebd6a1b73fe4aff9b03385b8e63b3)
1 /*	$OpenBSD: scsi_debug.h,v 1.13 2017/11/11 02:35:16 mlarkin Exp $	*/
2 /*	$NetBSD: scsi_debug.h,v 1.7 1996/10/12 23:23:16 christos Exp $	*/
3 
4 /*
5  * Written by Julian Elischer (julian@tfs.com)
6  */
7 #ifndef	_SCSI_SCSI_DEBUG_H
8 #define _SCSI_SCSI_DEBUG_H 1
9 #ifdef _KERNEL
10 
11 /*
12  * These are the new debug bits.  (Sat Oct  2 12:46:46 WST 1993)
13  * the following DEBUG bits are defined to exist in the flags word of
14  * the scsi_link structure.
15  */
16 #define	SDEV_DB1		0x0010	/* scsi commands, errors, data	*/
17 #define	SDEV_DB2		0x0020	/* routine flow tracking */
18 #define	SDEV_DB3		0x0040	/* internal to routine flows	*/
19 #define	SDEV_DB4		0x0080	/* level 4 debugging for this dev */
20 
21 /* targets and LUNs we want to debug */
22 #ifndef SCSIDEBUG_BUSES
23 #define SCSIDEBUG_BUSES		0
24 #endif
25 #ifndef SCSIDEBUG_TARGETS
26 #define	SCSIDEBUG_TARGETS	0
27 #endif
28 #ifndef SCSIDEBUG_LUNS
29 #define	SCSIDEBUG_LUNS		0
30 #endif
31 #ifndef SCSIDEBUG_LEVEL
32 #define	SCSIDEBUG_LEVEL		(SDEV_DB1|SDEV_DB2)
33 #endif
34 
35 
36 extern u_int32_t scsidebug_buses, scsidebug_targets, scsidebug_luns;
37 extern int scsidebug_level;
38 
39 /*
40  * This is the usual debug macro for use with the above bits
41  */
42 #ifdef	SCSIDEBUG
43 #define	SC_DEBUG(link,Level,Printstuff) do {\
44 	if ((link)->flags & (Level)) {	\
45 		sc_print_addr(link);		\
46 		printf Printstuff;		\
47 	} \
48 } while (0)
49 #define	SC_DEBUGN(link,Level,Printstuff) do {\
50 	if ((link)->flags & (Level)) {	\
51 		printf Printstuff;		\
52 	} \
53 } while (0)
54 #else
55 #define SC_DEBUG(A,B,C)
56 #define SC_DEBUGN(A,B,C)
57 #endif
58 
59 #endif /* _KERNEL */
60 #endif /* _SCSI_SCSI_DEBUG_H */
61