svn commit: r226288 - in stable/9/sys/dev: esp sym
Marius Strobl
marius at FreeBSD.org
Wed Oct 12 08:39:57 UTC 2011
Author: marius
Date: Wed Oct 12 08:39:57 2011
New Revision: 226288
URL: http://svn.freebsd.org/changeset/base/226288
Log:
MFC: r226095
Merge from r225950 (merged to stable/9 in r226067):
Set the sense residual properly.
Reviewed by: ken
Approved by: re (kib)
Modified:
stable/9/sys/dev/esp/ncr53c9x.c
stable/9/sys/dev/sym/sym_hipd.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
Modified: stable/9/sys/dev/esp/ncr53c9x.c
==============================================================================
--- stable/9/sys/dev/esp/ncr53c9x.c Wed Oct 12 08:08:08 2011 (r226287)
+++ stable/9/sys/dev/esp/ncr53c9x.c Wed Oct 12 08:39:57 2011 (r226288)
@@ -1367,7 +1367,8 @@ ncr53c9x_sense(struct ncr53c9x_softc *sc
ss->byte2 = ccb->ccb_h.target_lun << SCSI_CMD_LUN_SHIFT;
ss->length = sizeof(struct scsi_sense_data);
ecb->clen = sizeof(*ss);
- ecb->daddr = (char *)&ecb->ccb->csio.sense_data;
+ memset(&ccb->csio.sense_data, 0, sizeof(ccb->csio.sense_data));
+ ecb->daddr = (char *)&ccb->csio.sense_data;
ecb->dleft = sizeof(struct scsi_sense_data);
ecb->flags |= ECB_SENSE;
ecb->timeout = NCR_SENSE_TIMEOUT;
@@ -1397,7 +1398,7 @@ ncr53c9x_done(struct ncr53c9x_softc *sc,
union ccb *ccb = ecb->ccb;
struct ncr53c9x_linfo *li;
struct ncr53c9x_tinfo *ti;
- int lun;
+ int lun, sense_returned;
NCR_LOCK_ASSERT(sc, MA_OWNED);
@@ -1426,6 +1427,13 @@ ncr53c9x_done(struct ncr53c9x_softc *sc,
ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND;
ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR |
CAM_AUTOSNS_VALID;
+ sense_returned = sizeof(ccb->csio.sense_data) -
+ ecb->dleft;
+ if (sense_returned < ccb->csio.sense_len)
+ ccb->csio.sense_resid = ccb->csio.sense_len -
+ sense_returned;
+ else
+ ccb->csio.sense_resid = 0;
} else if (ecb->stat == SCSI_STATUS_CHECK_COND) {
if ((ecb->flags & ECB_SENSE) != 0)
ccb->ccb_h.status = CAM_AUTOSENSE_FAIL;
Modified: stable/9/sys/dev/sym/sym_hipd.c
==============================================================================
--- stable/9/sys/dev/sym/sym_hipd.c Wed Oct 12 08:08:08 2011 (r226287)
+++ stable/9/sys/dev/sym/sym_hipd.c Wed Oct 12 08:39:57 2011 (r226288)
@@ -7154,7 +7154,7 @@ static void sym_complete_error (hcb_p np
{
struct ccb_scsiio *csio;
u_int cam_status;
- int i;
+ int i, sense_returned;
SYM_LOCK_ASSERT(MA_OWNED);
@@ -7214,11 +7214,15 @@ static void sym_complete_error (hcb_p np
* Bounce back the sense data to user and
* fix the residual.
*/
- bzero(&csio->sense_data, csio->sense_len);
+ bzero(&csio->sense_data, sizeof(csio->sense_data));
+ sense_returned = SYM_SNS_BBUF_LEN - csio->sense_resid;
+ if (sense_returned < csio->sense_len)
+ csio->sense_resid = csio->sense_len -
+ sense_returned;
+ else
+ csio->sense_resid = 0;
bcopy(cp->sns_bbuf, &csio->sense_data,
- MIN(csio->sense_len, SYM_SNS_BBUF_LEN));
- csio->sense_resid += csio->sense_len;
- csio->sense_resid -= SYM_SNS_BBUF_LEN;
+ MIN(csio->sense_len, sense_returned));
#if 0
/*
* If the device reports a UNIT ATTENTION condition
More information about the svn-src-stable-9
mailing list