Module Name: src
Committed By: jdolecek
Date: Mon Nov 12 20:54:03 UTC 2018
Modified Files:
src/sys/dev/ic: mvsata.c
src/sys/dev/scsipi: atapi_wdc.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/scsipi/atapi_wdc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.45 src/sys/dev/ic/mvsata.c:1.46
--- src/sys/dev/ic/mvsata.c:1.45 Mon Nov 12 18:51:01 2018
+++ src/sys/dev/ic/mvsata.c Mon Nov 12 20:54:03 2018
@@ -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_poll(struct ata
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 @@ again:
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 @@ mvsata_atapi_reset(struct ata_channel *c
}
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 @@ mvsata_atapi_polldsc(void *arg)
ata_channel_lock(chp);
/* this will unlock channel lock too */
- mvsata_atapi_phase_complete(xfer);
+ mvsata_atapi_phase_complete(xfer, 0);
}
#endif /* NATAPIBUS > 0 */
Index: src/sys/dev/scsipi/atapi_wdc.c
diff -u src/sys/dev/scsipi/atapi_wdc.c:1.132 src/sys/dev/scsipi/atapi_wdc.c:1.133
--- src/sys/dev/scsipi/atapi_wdc.c:1.132 Mon Nov 12 18:51:01 2018
+++ src/sys/dev/scsipi/atapi_wdc.c Mon Nov 12 20:54:03 2018
@@ -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_start(struct ata_ch
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 @@ again:
#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 @@ again:
}
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 @@ wdc_atapi_phase_complete(struct ata_xfer
#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 @@ wdc_atapi_polldsc(void *arg)
ata_channel_lock(chp);
/* this will unlock channel lock too */
- wdc_atapi_phase_complete(xfer);
+ wdc_atapi_phase_complete(xfer, 0);
}