#ifndef _CAM_CAM_DEBUG_H
#define _CAM_CAM_DEBUG_H 1
typedef enum {
CAM_DEBUG_NONE = 0x00,
CAM_DEBUG_INFO = 0x01,
CAM_DEBUG_TRACE = 0x02,
CAM_DEBUG_SUBTRACE = 0x04,
CAM_DEBUG_CDB = 0x08,
CAM_DEBUG_XPT = 0x10,
CAM_DEBUG_PERIPH = 0x20,
CAM_DEBUG_PROBE = 0x40
} cam_debug_flags;
#if defined(_KERNEL)
#ifndef CAM_DEBUG_FLAGS
#define CAM_DEBUG_FLAGS CAM_DEBUG_NONE
#endif
#ifndef CAM_DEBUG_COMPILE
#ifdef CAMDEBUG
#define CAM_DEBUG_COMPILE (-1)
#else
#define CAM_DEBUG_COMPILE (CAM_DEBUG_INFO | CAM_DEBUG_CDB | \
CAM_DEBUG_PERIPH | CAM_DEBUG_PROBE | \
CAM_DEBUG_FLAGS)
#endif
#endif
#ifndef CAM_DEBUG_BUS
#define CAM_DEBUG_BUS CAM_BUS_WILDCARD
#endif
#ifndef CAM_DEBUG_TARGET
#define CAM_DEBUG_TARGET CAM_TARGET_WILDCARD
#endif
#ifndef CAM_DEBUG_LUN
#define CAM_DEBUG_LUN CAM_LUN_WILDCARD
#endif
#ifndef CAM_DEBUG_DELAY
#define CAM_DEBUG_DELAY 0
#endif
extern struct cam_path *cam_dpath;
extern uint32_t cam_dflags;
extern uint32_t cam_debug_delay;
struct cam_ed;
void xpt_cam_path_debug(struct cam_path *path, const char *fmt, ...);
void xpt_cam_dev_debug(struct cam_ed *dev, const char *fmt, ...);
void xpt_cam_debug(const char *fmt, ...);
#define _CAM_X(...) __VA_ARGS__
#define CAM_DEBUGGED(path, flag) \
(((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \
&& (cam_dpath != NULL) \
&& (xpt_path_comp(cam_dpath, (path)) >= 0) \
&& (xpt_path_comp(cam_dpath, (path)) < 2))
#define CAM_DEBUG(path, flag, printfargs) \
if (CAM_DEBUGGED(path, flag)) { \
xpt_cam_path_debug(path, _CAM_X printfargs); \
}
#define CAM_DEBUG_DEV(dev, flag, printfargs) \
if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \
&& (cam_dpath != NULL) \
&& (xpt_path_comp_dev(cam_dpath, (dev)) >= 0) \
&& (xpt_path_comp_dev(cam_dpath, (dev)) < 2)) { \
xpt_cam_dev_debug(dev, _CAM_X printfargs); \
}
#define CAM_DEBUG_PRINT(flag, printfargs) \
if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \
xpt_cam_debug(_CAM_X printfargs); \
}
#else
#define CAM_DEBUGGED(A, B) 0
#define CAM_DEBUG(A, B, C)
#define CAM_DEBUG_DEV(A, B, C)
#define CAM_DEBUG_PRINT(A, B)
#endif
#endif