Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi Add patch from Manuel Bouyer -- his mail mess...



details:   https://anonhg.NetBSD.org/src/rev/af5b507a54fe
branches:  trunk
changeset: 472730:af5b507a54fe
user:      perry <perry%NetBSD.org@localhost>
date:      Wed May 05 21:35:15 1999 +0000

description:
Add patch from Manuel Bouyer -- his mail message said:

By code inspection I found 2 bugs in the ATAPI code, one may be the cause
of your problem: A counter is not reset when issuing the request_sense
command. This is c_skip, the counter used to track the offset in the data
buffer when a data tranfer needs multiple phases. The effect of this is that
the sense data transfered may be stored outside the sense buffer (sense buffer
+ some, potentially several KB, offset). This can only occur in PIO mode,
DMA is not affected.
This doesn't occur in "normal" use because when reading a data CD, either
the sense is issued for a non-data command (in which case c_skip stays to
0), or an error occured and no data has been transfered, and c_skip is still 0.
I can't see a case where a data READ/WRITE could cause a sense tranfer without
error.

The second problem is that b_resid can be set to a false value (resulting of
the sense tranfer and not the data transfer). Again this is not a problem with
usual data tranfers because both values ends up being 0 when no error occurs.

diffstat:

 sys/dev/scsipi/atapi_wdc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r a4da825f262e -r af5b507a54fe sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Wed May 05 20:03:59 1999 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Wed May 05 21:35:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.22 1999/04/15 16:21:27 bouyer Exp $    */
+/*     $NetBSD: atapi_wdc.c,v 1.23 1999/05/05 21:35:15 perry Exp $     */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -620,6 +620,7 @@
                                sc_xfer->error = XS_SHORTSENSE;
                        }
                } else {
+                       sc_xfer->resid = xfer->c_bcount;
                        if (chp->ch_status & WDCS_ERR) {
                                /* save the short sense */
                                sc_xfer->error = XS_SHORTSENSE;
@@ -633,6 +634,7 @@
                                        xfer->databuf = &sc_xfer->sense;
                                        xfer->c_bcount =
                                            sizeof(sc_xfer->sense.scsi_sense);
+                                       xfer->c_skip = 0;
                                        xfer->c_flags |= C_SENSE;
                                        wdc_atapi_start(chp, xfer);
                                        return 1;
@@ -795,9 +797,7 @@
        WDCDEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n",
            chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
            (u_int)xfer->c_flags), DEBUG_XFERS);
-       sc_xfer->resid = xfer->c_bcount;
        /* remove this command from xfer queue */
-       xfer->c_skip = 0;
        wdc_free_xfer(chp, xfer);
        sc_xfer->flags |= ITSDONE;
        if (drvp->n_dmaerrs ||



Home | Main Index | Thread Index | Old Index