If we boot verbose, then print out 'interesting' CAM errors that otherwise
authorPeter Avalos <pavalos@dragonflybsd.org>
Sat, 24 Nov 2007 05:18:35 +0000 (05:18 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sat, 24 Nov 2007 05:18:35 +0000 (05:18 +0000)
would hide problems (like Selection Timeout).

Obtained-from: FreeBSD

sys/bus/cam/cam_periph.c

index 0b731a3..196ce2a 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_periph.c,v 1.24.2.3 2003/01/25 19:04:40 dillon Exp $
- * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.28 2007/11/22 00:59:49 pavalos Exp $
+ * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.29 2007/11/24 05:18:35 pavalos Exp $
  */
 
 #include <sys/param.h>
@@ -1227,6 +1227,10 @@ camperiphscsistatuserror(union ccb *ccb, cam_flags camflags,
                        }
                        *timeout = 0;
                        error = ERESTART;
+                       if (bootverbose) {
+                               xpt_print_path(ccb->ccb_h.path);
+                               kprintf("Queue Full\n");
+                       }
                        break;
                }
                /* FALLTHROUGH */
@@ -1236,6 +1240,10 @@ camperiphscsistatuserror(union ccb *ccb, cam_flags camflags,
                 * Restart the queue after either another
                 * command completes or a 1 second timeout.
                 */
+               if (bootverbose) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Device Busy\n");
+               }
                if (ccb->ccb_h.retry_count > 0) {
                        ccb->ccb_h.retry_count--;
                        error = ERESTART;
@@ -1247,9 +1255,13 @@ camperiphscsistatuserror(union ccb *ccb, cam_flags camflags,
                }
                break;
        case SCSI_STATUS_RESERV_CONFLICT:
+               xpt_print_path(ccb->ccb_h.path);
+               kprintf("Reservation Conflict\n");
                error = EIO;
                break;
        default:
+               xpt_print_path(ccb->ccb_h.path);
+               kprintf("SCSI Status 0x%x\n", ccb->csio.scsi_status);
                error = EIO;
                break;
        }
@@ -1348,7 +1360,7 @@ camperiphscsisenseerror(union ccb *ccb, cam_flags camflags,
                        error = 0;
                        break;
                case SS_RETRY:
-                       action_string = "Retrying Command";
+                       action_string = "Retrying Command (per Sense Data)";
                        error = ERESTART;
                        break;
                case SS_FAIL:
@@ -1456,11 +1468,10 @@ camperiphscsisenseerror(union ccb *ccb, cam_flags camflags,
 sense_error_done:
                if ((err_action & SSQ_PRINT_SENSE) != 0
                 && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0) {
-#if 0
-                       scsi_sense_print(&print_ccb->csio);
-#endif
                        cam_error_print(print_ccb, CAM_ESF_ALL, CAM_EPF_ALL);
                        xpt_print_path(ccb->ccb_h.path);
+                       if (bootverbose)
+                               scsi_sense_print(&print_ccb->csio);
                        kprintf("%s\n", action_string);
                }
        }
@@ -1479,7 +1490,7 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
        const char *action_string;
        cam_status  status;
        int         frozen;
-       int         error;
+       int         error, printed = 0;
        int         openings;
        u_int32_t   relsim_flags;
        u_int32_t   timeout;
@@ -1509,10 +1520,36 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
                error = EIO;    /* we have to kill the command */
                break;
        case CAM_REQ_CMP_ERR:
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Request completed with CAM_REQ_CMP_ERR\n");
+                       printed++;
+               }
        case CAM_CMD_TIMEOUT:
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Command timed out");
+                       printed++;
+               }
        case CAM_UNEXP_BUSFREE:
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Unexpected Bus Free");
+                       printed++;
+               }
        case CAM_UNCOR_PARITY:
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Uncorrected Parity Error");
+                       printed++;
+               }
        case CAM_DATA_RUN_ERR:
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Data Overrun");
+                       printed++;
+               }
+               error = EIO;    /* we have to kill the command */
                /* decrement the number of retries */
                if (ccb->ccb_h.retry_count > 0) {
                        ccb->ccb_h.retry_count--;
@@ -1537,6 +1574,11 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
 
                                ccb->ccb_h.retry_count--;
                                error = ERESTART;
+                               if (bootverbose && printed == 0) {
+                                       xpt_print_path(ccb->ccb_h.path);
+                                       kprintf("Selection Timeout");
+                                       printed++;
+                               }
 
                                /*
                                 * Wait a second to give the device
@@ -1581,10 +1623,23 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
                 * these events and should be unconditionally
                 * retried.
                 */
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       if (status == CAM_BDR_SENT)
+                               kprintf("Bus Device Reset sent\n");
+                       else
+                               kprintf("Bus Reset issued\n");
+                       printed++;
+               }
                /* FALLTHROUGH */
        case CAM_REQUEUE_REQ:
                /* Unconditional requeue */
                error = ERESTART;
+               if (bootverbose && printed == 0) {
+                       xpt_print_path(ccb->ccb_h.path);
+                       kprintf("Request Requeued\n");
+                       printed++;
+               }
                break;
        case CAM_RESRC_UNAVAIL:
        case CAM_BUSY:
@@ -1594,6 +1649,11 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
                if (ccb->ccb_h.retry_count > 0) {
                        ccb->ccb_h.retry_count--;
                        error = ERESTART;
+                       if (bootverbose && printed == 0) {
+                               xpt_print_path(ccb->ccb_h.path);
+                               kprintf("CAM Status 0x%x\n", status);
+                               printed++;
+                       }
                } else {
                        error = EIO;
                        action_string = "Retries Exhausted";