diff options
author | marius <marius@FreeBSD.org> | 2011-10-13 20:06:19 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2011-10-13 20:06:19 +0000 |
commit | 03f042f32ea4a1b4d4867c8d56885f1f29f8b5b0 (patch) | |
tree | c06ee1d9af97642c074b8b2f67c22e536ea6a8fb /sys/dev/aac | |
parent | 9d926ddf66d0bdefacfd2f642dd15d42f3a2194b (diff) | |
download | FreeBSD-src-03f042f32ea4a1b4d4867c8d56885f1f29f8b5b0.zip FreeBSD-src-03f042f32ea4a1b4d4867c8d56885f1f29f8b5b0.tar.gz |
Merge from r225950:
Set the sense residual properly.
Reviewed by: ken
Diffstat (limited to 'sys/dev/aac')
-rw-r--r-- | sys/dev/aac/aac_cam.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c index 130cd20..b5c3b26 100644 --- a/sys/dev/aac/aac_cam.c +++ b/sys/dev/aac/aac_cam.c @@ -532,6 +532,7 @@ aac_cam_complete(struct aac_command *cm) union ccb *ccb; struct aac_srb_response *srbr; struct aac_softc *sc; + int sense_returned; sc = cm->cm_sc; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -556,16 +557,17 @@ aac_cam_complete(struct aac_command *cm) /* Take care of autosense */ if (srbr->sense_len) { - int sense_len, scsi_sense_len; - - scsi_sense_len = sizeof(struct scsi_sense_data); - bzero(&ccb->csio.sense_data, scsi_sense_len); - sense_len = (srbr->sense_len > - scsi_sense_len) ? scsi_sense_len : - srbr->sense_len; + sense_returned = srbr->sense_len; + if (sense_returned < ccb->csio.sense_len) + ccb->csio.sense_resid = + ccb->csio.sense_len - + sense_returned; + else + ccb->csio.sense_resid = 0; + bzero(&ccb->csio.sense_data, + sizeof(struct scsi_sense_data)); bcopy(&srbr->sense[0], &ccb->csio.sense_data, - srbr->sense_len); - ccb->csio.sense_len = sense_len; + min(ccb->csio.sense_len, sense_returned)); ccb->ccb_h.status |= CAM_AUTOSNS_VALID; // scsi_sense_print(&ccb->csio); } |