diff options
author | mav <mav@FreeBSD.org> | 2009-11-03 11:19:05 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-11-03 11:19:05 +0000 |
commit | 73c660a883a03b4be59c916f55862979153ec0c7 (patch) | |
tree | 338894679113e0e6bae94d009989d5703547dec8 /sys/cam/cam.c | |
parent | 6f248c8fee50277b8f1a151856fb9704052668de (diff) | |
download | FreeBSD-src-73c660a883a03b4be59c916f55862979153ec0c7.zip FreeBSD-src-73c660a883a03b4be59c916f55862979153ec0c7.tar.gz |
MFp4:
Improve reporting ATA Status error details.
Diffstat (limited to 'sys/cam/cam.c')
-rw-r--r-- | sys/cam/cam.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/sys/cam/cam.c b/sys/cam/cam.c index 120050a..eff83a1 100644 --- a/sys/cam/cam.c +++ b/sys/cam/cam.c @@ -229,6 +229,21 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, return(NULL); switch (ccb->ccb_h.func_code) { + case XPT_ATA_IO: + switch (proto_flags & CAM_EPF_LEVEL_MASK) { + case CAM_EPF_NONE: + break; + case CAM_EPF_ALL: + case CAM_EPF_NORMAL: + proto_flags |= CAM_EAF_PRINT_RESULT; + /* FALLTHROUGH */ + case CAM_EPF_MINIMAL: + proto_flags |= CAM_EAF_PRINT_STATUS; + /* FALLTHROUGH */ + default: + break; + } + break; case XPT_SCSI_IO: switch (proto_flags & CAM_EPF_LEVEL_MASK) { case CAM_EPF_NONE: @@ -256,10 +271,12 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, sbuf_new(&sb, str, str_len, 0); if (flags & CAM_ESF_COMMAND) { - sbuf_cat(&sb, path_str); - switch (ccb->ccb_h.func_code) { + case XPT_ATA_IO: + ata_command_sbuf(&ccb->ataio, &sb); + sbuf_printf(&sb, "\n"); + break; case XPT_SCSI_IO: #ifdef _KERNEL scsi_command_string(&ccb->csio, &sb); @@ -267,7 +284,6 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, scsi_command_string(device, &ccb->csio, &sb); #endif /* _KERNEL/!_KERNEL */ sbuf_printf(&sb, "\n"); - break; default: break; @@ -295,6 +311,22 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, if (flags & CAM_ESF_PROTO_STATUS) { switch (ccb->ccb_h.func_code) { + case XPT_ATA_IO: + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != + CAM_ATA_STATUS_ERROR) + break; + if (proto_flags & CAM_EAF_PRINT_STATUS) { + sbuf_cat(&sb, path_str); + ata_status_sbuf(&ccb->ataio, &sb); + sbuf_printf(&sb, "\n"); + } + if (proto_flags & CAM_EAF_PRINT_RESULT) { + sbuf_cat(&sb, path_str); + ata_res_sbuf(&ccb->ataio, &sb); + sbuf_printf(&sb, "\n"); + } + + break; case XPT_SCSI_IO: if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) @@ -302,10 +334,6 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, if (proto_flags & CAM_ESF_PRINT_STATUS) { sbuf_cat(&sb, path_str); - /* - * Print out the SCSI status byte as long as - * the user wants some protocol output. - */ sbuf_printf(&sb, "SCSI Status: %s\n", scsi_status_string(&ccb->csio)); } |