Source-Changes-HG archive

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

[src/trunk]: src/sys/dev pass correct status + error to *_atapi_phase_complet...



details:   https://anonhg.NetBSD.org/src/rev/798c8146c94c
branches:  trunk
changeset: 994541:798c8146c94c
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Nov 12 20:54:03 2018 +0000

description:
pass correct status + error to *_atapi_phase_complete(), so that
the function is actually able to recognize when there was an error;
tested via reading a cd0 device in QEMU with ejected cdrom

bug was introduced with jdolecek-ncq branch

fixes PR kern/53724 by Andreas Gustafsson

diffstat:

 sys/dev/ic/mvsata.c        |  13 ++++++-------
 sys/dev/scsipi/atapi_wdc.c |  13 ++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diffs (121 lines):

diff -r cd944add6ada -r 798c8146c94c sys/dev/ic/mvsata.c
--- a/sys/dev/ic/mvsata.c       Mon Nov 12 20:07:47 2018 +0000
+++ b/sys/dev/ic/mvsata.c       Mon Nov 12 20:54:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $     */
+/*     $NetBSD: mvsata.c,v 1.46 2018/11/12 20:54:03 jdolecek Exp $     */
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.46 2018/11/12 20:54:03 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -161,7 +161,7 @@
 static void mvsata_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *,
                                   int);
 static void mvsata_atapi_reset(struct ata_channel *, struct ata_xfer *);
-static void mvsata_atapi_phase_complete(struct ata_xfer *);
+static void mvsata_atapi_phase_complete(struct ata_xfer *, int);
 static void mvsata_atapi_done(struct ata_channel *, struct ata_xfer *);
 static void mvsata_atapi_polldsc(void *);
 #endif
@@ -2422,7 +2422,7 @@
                        xfer->c_bcount -= sc_xfer->datalen;
                sc_xfer->resid = xfer->c_bcount;
                /* this will unlock channel lock too */
-               mvsata_atapi_phase_complete(xfer);
+               mvsata_atapi_phase_complete(xfer, tfd);
                return 1;
 
        default:
@@ -2522,14 +2522,13 @@
 }
 
 static void
-mvsata_atapi_phase_complete(struct ata_xfer *xfer)
+mvsata_atapi_phase_complete(struct ata_xfer *xfer, int tfd)
 {
        struct ata_channel *chp = xfer->c_chp;
        struct atac_softc *atac = chp->ch_atac;
        struct wdc_softc *wdc = CHAN_TO_WDC(chp);
        struct scsipi_xfer *sc_xfer = xfer->c_scsipi;
        struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
-       int tfd = 0;
 
        ata_channel_lock_owned(chp);
 
@@ -2654,7 +2653,7 @@
        ata_channel_lock(chp);
 
        /* this will unlock channel lock too */
-       mvsata_atapi_phase_complete(xfer);
+       mvsata_atapi_phase_complete(xfer, 0);
 }
 #endif /* NATAPIBUS > 0 */
 
diff -r cd944add6ada -r 798c8146c94c sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Mon Nov 12 20:07:47 2018 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Mon Nov 12 20:54:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.132 2018/11/12 18:51:01 jdolecek Exp $ */
+/*     $NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.132 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -89,7 +89,7 @@
 static int     wdc_atapi_intr(struct ata_channel *, struct ata_xfer *, int);
 static void    wdc_atapi_kill_xfer(struct ata_channel *,
                                    struct ata_xfer *, int);
-static void    wdc_atapi_phase_complete(struct ata_xfer *);
+static void    wdc_atapi_phase_complete(struct ata_xfer *, int);
 static void    wdc_atapi_poll(struct ata_channel *, struct ata_xfer *);
 static void    wdc_atapi_done(struct ata_channel *, struct ata_xfer *);
 static void    wdc_atapi_reset(struct ata_channel *, struct ata_xfer *);
@@ -1018,7 +1018,7 @@
 #endif
                sc_xfer->resid = xfer->c_bcount;
                /* this will unlock channel lock too */
-               wdc_atapi_phase_complete(xfer);
+               wdc_atapi_phase_complete(xfer, tfd);
                return(1);
 
        default:
@@ -1058,7 +1058,7 @@
 }
 
 static void
-wdc_atapi_phase_complete(struct ata_xfer *xfer)
+wdc_atapi_phase_complete(struct ata_xfer *xfer, int tfd)
 {
        struct ata_channel *chp = xfer->c_chp;
        struct atac_softc *atac = chp->ch_atac;
@@ -1067,7 +1067,6 @@
 #endif
        struct scsipi_xfer *sc_xfer = xfer->c_scsipi;
        struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
-       int tfd = 0;
 
        ata_channel_lock_owned(chp);
 
@@ -1207,5 +1206,5 @@
        ata_channel_lock(chp);
 
        /* this will unlock channel lock too */
-       wdc_atapi_phase_complete(xfer);
+       wdc_atapi_phase_complete(xfer, 0);
 }



Home | Main Index | Thread Index | Old Index