diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2009-03-16 15:08:47 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2009-03-16 15:08:47 +0000 |
commit | 1b9ce75c3ebb47112198462fb8f1b7e78aed0b93 (patch) | |
tree | 4796f4dc3610120655e39e7f61e25576122daad7 /sys | |
parent | 2c34d09c93e28b4a984aec52b13174a5e2519b51 (diff) |
When doing pass-through calculate right xs->resid value based on
the info hardware returnes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/ips.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index 3708b41b19d..bc105332923 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.68 2009/03/16 14:04:04 grange Exp $ */ +/* $OpenBSD: ips.c,v 1.69 2009/03/16 15:08:46 grange Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org> @@ -1275,7 +1275,7 @@ ips_load_xs(struct ips_softc *sc, struct ips_ccb *ccb, struct scsi_xfer *xs) if ((nsegs = ccb->c_dmam->dm_nsegs) > IPS_MAXSGS) return (1); - if (nsegs > 1) { + if (nsegs > 1) { cmd->sgcnt = nsegs; cmd->sgaddr = htole32(ccb->c_cmdbpa + offsetof(struct ips_cmdb, sg)); @@ -1431,7 +1431,7 @@ ips_done_pt(struct ips_softc *sc, struct ips_ccb *ccb) struct ips_pt *pt = link->adapter_softc; struct ips_cmdb *cmdb = ccb->c_cmdbva; struct ips_dcdb *dcdb = &cmdb->dcdb; - int target = link->target; + int target = link->target, done = letoh16(dcdb->datalen); if (!(xs->flags & SCSI_POLL)) timeout_del(&xs->stimeout); @@ -1443,7 +1443,10 @@ ips_done_pt(struct ips_softc *sc, struct ips_ccb *ccb) bus_dmamap_unload(sc->sc_dmat, ccb->c_dmam); } - xs->resid = 0; + if (done && done < xs->datalen) + xs->resid = xs->datalen - done; + else + xs->resid = 0; xs->error = ccb->c_error; xs->status = dcdb->status; |