summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2012-06-07 10:53:42 +0000
committermav <mav@FreeBSD.org>2012-06-07 10:53:42 +0000
commit7a24c2b54fa20c420419c4e577cb2678c7bf7701 (patch)
tree192ac7dcf457babb8df08fe270f9417bbd3f82d2 /sys/cam
parent56a5c844a23a1f17eeeaeea291f87ddd18c74914 (diff)
downloadFreeBSD-src-7a24c2b54fa20c420419c4e577cb2678c7bf7701.zip
FreeBSD-src-7a24c2b54fa20c420419c4e577cb2678c7bf7701.tar.gz
Add CAM_DEBUG_INFO debug messages for periph created/invalidated/destroyed
and for asyncs sent.
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_periph.c4
-rw-r--r--sys/cam/cam_xpt.c28
2 files changed, 29 insertions, 3 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index bf8d4cc..50bf5de 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -240,6 +240,7 @@ cam_periph_alloc(periph_ctor_t *periph_ctor,
goto failure;
init_level++;
+ CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph created\n"));
status = periph_ctor(periph, arg);
@@ -252,6 +253,7 @@ failure:
/* Initialized successfully */
break;
case 3:
+ CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
xpt_remove_periph(periph);
/* FALLTHROUGH */
case 2:
@@ -572,6 +574,7 @@ void
cam_periph_invalidate(struct cam_periph *periph)
{
+ CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n"));
/*
* We only call this routine the first time a peripheral is
* invalidated.
@@ -610,6 +613,7 @@ camperiphfree(struct cam_periph *periph)
if (periph->periph_dtor != NULL)
periph->periph_dtor(periph);
xpt_remove_periph(periph);
+ CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) {
union ccb ccb;
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 0dc763d..9b88f42 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -2973,7 +2973,7 @@ xpt_action_default(union ccb *start_ccb)
}
case XPT_DEBUG: {
/* Check that all request bits are supported. */
- if (start_ccb->cdbg.flags & ~CAM_DEBUG_COMPILE) {
+ if (start_ccb->cdbg.flags & ~(CAM_DEBUG_COMPILE)) {
start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
break;
}
@@ -4033,6 +4033,28 @@ xptpathid(const char *sim_name, int sim_unit, int sim_bus)
return (pathid);
}
+static const char *
+xpt_async_string(u_int32_t async_code)
+{
+
+ switch (async_code) {
+ case AC_BUS_RESET: return ("AC_BUS_RESET");
+ case AC_UNSOL_RESEL: return ("AC_UNSOL_RESEL");
+ case AC_SCSI_AEN: return ("AC_SCSI_AEN");
+ case AC_SENT_BDR: return ("AC_SENT_BDR");
+ case AC_PATH_REGISTERED: return ("AC_PATH_REGISTERED");
+ case AC_PATH_DEREGISTERED: return ("AC_PATH_DEREGISTERED");
+ case AC_FOUND_DEVICE: return ("AC_FOUND_DEVICE");
+ case AC_LOST_DEVICE: return ("AC_LOST_DEVICE");
+ case AC_TRANSFER_NEG: return ("AC_TRANSFER_NEG");
+ case AC_INQ_CHANGED: return ("AC_INQ_CHANGED");
+ case AC_GETDEV_CHANGED: return ("AC_GETDEV_CHANGED");
+ case AC_CONTRACT: return ("AC_CONTRACT");
+ case AC_ADVINFO_CHANGED: return ("AC_ADVINFO_CHANGED");
+ }
+ return ("AC_UNKNOWN");
+}
+
void
xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
{
@@ -4041,8 +4063,8 @@ xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
struct cam_ed *device, *next_device;
mtx_assert(path->bus->sim->mtx, MA_OWNED);
-
- CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n"));
+ CAM_DEBUG(path, CAM_DEBUG_TRACE | CAM_DEBUG_INFO,
+ ("xpt_async(%s)\n", xpt_async_string(async_code)));
/*
* Most async events come from a CAM interrupt context. In
OpenPOWER on IntegriCloud