diff options
author | Alexander Motin <mav@FreeBSD.org> | 2009-11-03 11:19:05 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2009-11-03 11:19:05 +0000 |
commit | 8691755dff5aa6e56a864e3bceee2bbf8ef57675 (patch) | |
tree | 338894679113e0e6bae94d009989d5703547dec8 /sys/cam/cam.c | |
parent | 1575bd0a6d699d264e2eaff24bd35061fcffac57 (diff) | |
download | src-8691755dff5aa6e56a864e3bceee2bbf8ef57675.tar.gz src-8691755dff5aa6e56a864e3bceee2bbf8ef57675.zip |
MFp4:
Improve reporting ATA Status error details.
Notes
Notes:
svn path=/head/; revision=198849
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 120050a52772..eff83a1ad13a 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)); } |