Only print sense data diagnostics if debugging is enabled with the
authorPeter Avalos <pavalos@dragonflybsd.org>
Thu, 6 Mar 2008 20:01:29 +0000 (20:01 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Thu, 6 Mar 2008 20:01:29 +0000 (20:01 +0000)
AHD_SHOW_SENSE flag.

Obtained-from: FreeBSD

sys/dev/disk/aic7xxx/aic79xx_osm.c

index 2a39ef7..fa14057 100644 (file)
@@ -32,7 +32,7 @@
  * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.c#35 $
  *
  * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.23 2005/12/04 02:12:40 ru Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.23 2008/02/10 00:01:02 pavalos Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.24 2008/03/06 20:01:29 pavalos Exp $
  */
 
 #include "aic79xx_osm.h"
@@ -304,7 +304,6 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
        } else if ((scb->flags & SCB_PKT_SENSE) != 0) {
                struct scsi_status_iu_header *siu;
                u_int sense_len;
-               int i;
 
                /*
                 * Copy only the sense data into the provided buffer.
@@ -316,11 +315,18 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
                memcpy(&ccb->csio.sense_data,
                       ahd_get_sense_buf(ahd, scb) + SIU_SENSE_OFFSET(siu),
                       sense_len);
-               kprintf("Copied %d bytes of sense data offset %d:", sense_len,
-                      SIU_SENSE_OFFSET(siu));
-               for (i = 0; i < sense_len; i++)
-                       kprintf(" 0x%x", ((uint8_t *)&ccb->csio.sense_data)[i]);
-               kprintf("\n");
+#ifdef AHD_DEBUG
+               if ((ahd_debug & AHD_SHOW_SENSE) != 0) {
+                       uint8_t *sense_data = (uint8_t *)&ccb->csio.sense_data;
+                       u_int i;
+
+                       kprintf("Copied %d bytes of sense data offset %d:",
+                              sense_len, SIU_SENSE_OFFSET(siu));
+                       for (i = 0; i < sense_len; i++)
+                               kprintf(" 0x%x", *sense_data++);
+                       kprintf("\n");
+               }
+#endif
                scb->io_ctx->ccb_h.status |= CAM_AUTOSNS_VALID;
        }
        ccb->ccb_h.status &= ~CAM_SIM_QUEUED;