Created
August 19, 2022 21:44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: sys/dev/ata/ata.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ata/ata.c,v | |
retrieving revision 1.149.2.1 | |
diff -p -u -r1.149.2.1 ata.c | |
--- sys/dev/ata/ata.c 15 Mar 2022 18:00:26 -0000 1.149.2.1 | |
+++ sys/dev/ata/ata.c 19 Aug 2022 20:41:55 -0000 | |
@@ -1218,10 +1218,11 @@ int | |
ata_xfer_start(struct ata_xfer *xfer) | |
{ | |
struct ata_channel *chp = xfer->c_chp; | |
- int rv; | |
+ int rv, status; | |
KASSERT(mutex_owned(&chp->ch_lock)); | |
+again: | |
rv = xfer->ops->c_start(chp, xfer); | |
switch (rv) { | |
case ATASTART_STARTED: | |
@@ -1235,8 +1236,10 @@ ata_xfer_start(struct ata_xfer *xfer) | |
/* can happen even in thread context for some ATAPI devices */ | |
ata_channel_unlock(chp); | |
KASSERT(xfer->ops != NULL && xfer->ops->c_poll != NULL); | |
- xfer->ops->c_poll(chp, xfer); | |
+ status = xfer->ops->c_poll(chp, xfer); | |
ata_channel_lock(chp); | |
+ if (status == ATAPOLL_AGAIN) | |
+ goto again; | |
break; | |
case ATASTART_ABORT: | |
ata_channel_unlock(chp); | |
Index: sys/dev/ata/ata_wdc.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ata/ata_wdc.c,v | |
retrieving revision 1.113 | |
diff -p -u -r1.113 ata_wdc.c | |
--- sys/dev/ata/ata_wdc.c 12 Nov 2018 18:51:01 -0000 1.113 | |
+++ sys/dev/ata/ata_wdc.c 19 Aug 2022 20:41:55 -0000 | |
@@ -105,7 +105,7 @@ extern int wdcdebug_wd_mask; /* inited i | |
static int wdc_ata_bio(struct ata_drive_datas*, struct ata_xfer *); | |
static int wdc_ata_bio_start(struct ata_channel *,struct ata_xfer *); | |
static int _wdc_ata_bio_start(struct ata_channel *,struct ata_xfer *); | |
-static void wdc_ata_bio_poll(struct ata_channel *,struct ata_xfer *); | |
+static int wdc_ata_bio_poll(struct ata_channel *,struct ata_xfer *); | |
static int wdc_ata_bio_intr(struct ata_channel *, struct ata_xfer *, | |
int); | |
static void wdc_ata_bio_kill_xfer(struct ata_channel *, | |
@@ -617,7 +617,7 @@ timeout: | |
return ATASTART_ABORT; | |
} | |
-static void | |
+static int | |
wdc_ata_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
/* Wait for at last 400ns for status bit to be valid */ | |
@@ -629,6 +629,7 @@ wdc_ata_bio_poll(struct ata_channel *chp | |
} | |
#endif | |
wdc_ata_bio_intr(chp, xfer, 0); | |
+ return (xfer->c_bio.flags & ATA_ITSDONE) ? ATAPOLL_DONE : ATAPOLL_AGAIN; | |
} | |
static int | |
@@ -779,7 +780,10 @@ end: | |
/* Start the next operation */ | |
ata_xfer_start(xfer); | |
} else { | |
- /* Let _wdc_ata_bio_start do the loop */ | |
+ /* | |
+ * Let ata_xfer_start() do the loop; | |
+ * see wdc_ata_bio_poll(). | |
+ */ | |
} | |
ata_channel_unlock(chp); | |
return 1; | |
Index: sys/dev/ata/atavar.h | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ata/atavar.h,v | |
retrieving revision 1.103 | |
diff -p -u -r1.103 atavar.h | |
--- sys/dev/ata/atavar.h 5 Apr 2019 21:31:44 -0000 1.103 | |
+++ sys/dev/ata/atavar.h 19 Aug 2022 20:41:55 -0000 | |
@@ -178,7 +178,9 @@ struct ata_xfer_ops { | |
#define ATASTART_TH 1 /* xfer needs to be run in thread */ | |
#define ATASTART_POLL 2 /* xfer needs to be polled */ | |
#define ATASTART_ABORT 3 /* error occurred, abort xfer */ | |
- void (*c_poll)(struct ata_channel *, struct ata_xfer *); | |
+ int (*c_poll)(struct ata_channel *, struct ata_xfer *); | |
+#define ATAPOLL_DONE 0 | |
+#define ATAPOLL_AGAIN 1 | |
void (*c_abort)(struct ata_channel *, struct ata_xfer *); | |
int (*c_intr)(struct ata_channel *, struct ata_xfer *, int); | |
void (*c_kill_xfer)(struct ata_channel *, struct ata_xfer *, int); | |
Index: sys/dev/ic/ahcisata_core.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ic/ahcisata_core.c,v | |
retrieving revision 1.75.4.4 | |
diff -p -u -r1.75.4.4 ahcisata_core.c | |
--- sys/dev/ic/ahcisata_core.c 30 Dec 2020 15:12:38 -0000 1.75.4.4 | |
+++ sys/dev/ic/ahcisata_core.c 19 Aug 2022 20:44:16 -0000 | |
@@ -69,13 +69,13 @@ static void ahci_killpending(struct ata_ | |
static int ahci_cmd_start(struct ata_channel *, struct ata_xfer *); | |
static int ahci_cmd_complete(struct ata_channel *, struct ata_xfer *, int); | |
-static void ahci_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
+static int ahci_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
static void ahci_cmd_abort(struct ata_channel *, struct ata_xfer *); | |
static void ahci_cmd_done(struct ata_channel *, struct ata_xfer *); | |
static void ahci_cmd_done_end(struct ata_channel *, struct ata_xfer *); | |
static void ahci_cmd_kill_xfer(struct ata_channel *, struct ata_xfer *, int); | |
static int ahci_bio_start(struct ata_channel *, struct ata_xfer *); | |
-static void ahci_bio_poll(struct ata_channel *, struct ata_xfer *); | |
+static int ahci_bio_poll(struct ata_channel *, struct ata_xfer *); | |
static void ahci_bio_abort(struct ata_channel *, struct ata_xfer *); | |
static int ahci_bio_complete(struct ata_channel *, struct ata_xfer *, int); | |
static void ahci_bio_kill_xfer(struct ata_channel *, struct ata_xfer *, int) ; | |
@@ -93,7 +93,7 @@ static void ahci_atapi_minphys(struct bu | |
static void ahci_atapi_scsipi_request(struct scsipi_channel *, | |
scsipi_adapter_req_t, void *); | |
static int ahci_atapi_start(struct ata_channel *, struct ata_xfer *); | |
-static void ahci_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
+static int ahci_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
static void ahci_atapi_abort(struct ata_channel *, struct ata_xfer *); | |
static int ahci_atapi_complete(struct ata_channel *, struct ata_xfer *, int); | |
static void ahci_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *, int); | |
@@ -1227,7 +1227,7 @@ ahci_cmd_start(struct ata_channel *chp, | |
return ATASTART_POLL; | |
} | |
-static void | |
+static int | |
ahci_cmd_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct ahci_softc *sc = AHCI_CH2SC(chp); | |
@@ -1264,6 +1264,8 @@ ahci_cmd_poll(struct ata_channel *chp, s | |
} | |
/* reenable interrupts */ | |
AHCI_WRITE(sc, AHCI_GHC, AHCI_READ(sc, AHCI_GHC) | AHCI_GHC_IE); | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
static void | |
@@ -1473,7 +1475,7 @@ ahci_bio_start(struct ata_channel *chp, | |
return ATASTART_POLL; | |
} | |
-static void | |
+static int | |
ahci_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac; | |
@@ -1503,6 +1505,7 @@ ahci_bio_poll(struct ata_channel *chp, s | |
} | |
/* reenable interrupts */ | |
AHCI_WRITE(sc, AHCI_GHC, AHCI_READ(sc, AHCI_GHC) | AHCI_GHC_IE); | |
+ return ATAPOLL_DONE; | |
} | |
static void | |
@@ -1970,7 +1973,7 @@ ahci_atapi_start(struct ata_channel *chp | |
return ATASTART_POLL; | |
} | |
-static void | |
+static int | |
ahci_atapi_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac; | |
@@ -2000,6 +2003,7 @@ ahci_atapi_poll(struct ata_channel *chp, | |
} | |
/* reenable interrupts */ | |
AHCI_WRITE(sc, AHCI_GHC, AHCI_READ(sc, AHCI_GHC) | AHCI_GHC_IE); | |
+ return ATAPOLL_DONE; | |
} | |
static void | |
Index: sys/dev/ic/mvsata.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ic/mvsata.c,v | |
retrieving revision 1.48 | |
diff -p -u -r1.48 mvsata.c | |
--- sys/dev/ic/mvsata.c 23 Jun 2019 06:33:17 -0000 1.48 | |
+++ sys/dev/ic/mvsata.c 19 Aug 2022 20:41:55 -0000 | |
@@ -143,14 +143,14 @@ static void mvsata_setup_channel(struct | |
#ifndef MVSATA_WITHOUTDMA | |
static int mvsata_bio_start(struct ata_channel *, struct ata_xfer *); | |
static int mvsata_bio_intr(struct ata_channel *, struct ata_xfer *, int); | |
-static void mvsata_bio_poll(struct ata_channel *, struct ata_xfer *); | |
+static int mvsata_bio_poll(struct ata_channel *, struct ata_xfer *); | |
static void mvsata_bio_kill_xfer(struct ata_channel *, struct ata_xfer *, int); | |
static void mvsata_bio_done(struct ata_channel *, struct ata_xfer *); | |
static int mvsata_bio_ready(struct mvsata_port *, struct ata_bio *, int, | |
int); | |
static int mvsata_wdc_cmd_start(struct ata_channel *, struct ata_xfer *); | |
static int mvsata_wdc_cmd_intr(struct ata_channel *, struct ata_xfer *, int); | |
-static void mvsata_wdc_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
+static int mvsata_wdc_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
static void mvsata_wdc_cmd_kill_xfer(struct ata_channel *, struct ata_xfer *, | |
int); | |
static void mvsata_wdc_cmd_done(struct ata_channel *, struct ata_xfer *); | |
@@ -158,7 +158,7 @@ static void mvsata_wdc_cmd_done_end(stru | |
#if NATAPIBUS > 0 | |
static int mvsata_atapi_start(struct ata_channel *, struct ata_xfer *); | |
static int mvsata_atapi_intr(struct ata_channel *, struct ata_xfer *, int); | |
-static void mvsata_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
+static int mvsata_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
static void mvsata_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *, | |
int); | |
static void mvsata_atapi_reset(struct ata_channel *, struct ata_xfer *); | |
@@ -1263,7 +1263,7 @@ timeout: | |
return ATASTART_ABORT; | |
} | |
-static void | |
+static int | |
mvsata_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct mvsata_port *mvport = (struct mvsata_port *)chp; | |
@@ -1277,10 +1277,9 @@ mvsata_bio_poll(struct ata_channel *chp, | |
chp->ch_flags &= ~ATACH_DMA_WAIT; | |
} | |
- if ((xfer->c_bio.flags & ATA_ITSDONE) == 0) { | |
- KASSERT(xfer->c_flags & C_TIMEOU); | |
- mvsata_bio_intr(chp, xfer, 0); | |
- } | |
+ mvsata_bio_intr(chp, xfer, 0); | |
+ | |
+ return (xfer->c_bio.flags & ATA_ITSDONE) ? ATAPOLL_DONE : ATAPOLL_AGAIN; | |
} | |
static int | |
@@ -1403,7 +1402,10 @@ end: | |
/* Start the next operation */ | |
ata_xfer_start(xfer); | |
} else { | |
- /* Let mvsata_bio_start do the loop */ | |
+ /* | |
+ * Let ata_xfer_start() do the loop; | |
+ * see mvsata_bio_poll(). | |
+ */ | |
} | |
ata_channel_unlock(chp); | |
} else { /* Done with this transfer */ | |
@@ -1715,7 +1717,7 @@ mvsata_wdc_cmd_start(struct ata_channel | |
return ATASTART_POLL; | |
} | |
-static void | |
+static int | |
mvsata_wdc_cmd_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
/* | |
@@ -1724,6 +1726,7 @@ mvsata_wdc_cmd_poll(struct ata_channel * | |
*/ | |
delay(10); /* 400ns delay */ | |
mvsata_wdc_cmd_intr(chp, xfer, 0); | |
+ return ATAPOLL_DONE; | |
} | |
static int | |
@@ -2200,7 +2203,7 @@ error: | |
return ATASTART_ABORT; | |
} | |
-static void | |
+static int | |
mvsata_atapi_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
/* | |
@@ -2215,7 +2218,7 @@ mvsata_atapi_poll(struct ata_channel *ch | |
mvsata_atapi_intr(chp, xfer, 0); | |
if (!poll) | |
- return; | |
+ return ATAPOLL_DONE; | |
if (chp->ch_flags & ATACH_DMA_WAIT) { | |
wdc_dmawait(chp, xfer, xfer->c_scsipi->timeout); | |
@@ -2227,6 +2230,8 @@ mvsata_atapi_poll(struct ata_channel *ch | |
DELAY(1); | |
mvsata_atapi_intr(chp, xfer, 0); | |
} | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
static int | |
Index: sys/dev/ic/siisata.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ic/siisata.c,v | |
retrieving revision 1.39 | |
diff -p -u -r1.39 siisata.c | |
--- sys/dev/ic/siisata.c 19 Nov 2018 19:52:08 -0000 1.39 | |
+++ sys/dev/ic/siisata.c 19 Aug 2022 20:41:55 -0000 | |
@@ -149,7 +149,7 @@ void siisata_killpending(struct ata_driv | |
int siisata_cmd_start(struct ata_channel *, struct ata_xfer *); | |
int siisata_cmd_complete(struct ata_channel *, struct ata_xfer *, int); | |
-void siisata_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
+int siisata_cmd_poll(struct ata_channel *, struct ata_xfer *); | |
void siisata_cmd_abort(struct ata_channel *, struct ata_xfer *); | |
void siisata_cmd_done(struct ata_channel *, struct ata_xfer *, int); | |
static void siisata_cmd_done_end(struct ata_channel *, struct ata_xfer *); | |
@@ -157,7 +157,7 @@ void siisata_cmd_kill_xfer(struct ata_ch | |
int siisata_bio_start(struct ata_channel *, struct ata_xfer *); | |
int siisata_bio_complete(struct ata_channel *, struct ata_xfer *, int); | |
-void siisata_bio_poll(struct ata_channel *, struct ata_xfer *); | |
+int siisata_bio_poll(struct ata_channel *, struct ata_xfer *); | |
void siisata_bio_abort(struct ata_channel *, struct ata_xfer *); | |
void siisata_bio_kill_xfer(struct ata_channel *, struct ata_xfer *, int); | |
int siisata_exec_command(struct ata_drive_datas *, struct ata_xfer *); | |
@@ -175,7 +175,7 @@ void siisata_atapi_probe_device(struct a | |
void siisata_atapi_minphys(struct buf *); | |
int siisata_atapi_start(struct ata_channel *,struct ata_xfer *); | |
int siisata_atapi_complete(struct ata_channel *, struct ata_xfer *, int); | |
-void siisata_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
+int siisata_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
void siisata_atapi_abort(struct ata_channel *, struct ata_xfer *); | |
void siisata_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *, int); | |
void siisata_atapi_scsipi_request(struct scsipi_channel *, | |
@@ -1025,7 +1025,7 @@ siisata_cmd_start(struct ata_channel *ch | |
return ATASTART_POLL; | |
} | |
-void | |
+int | |
siisata_cmd_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct siisata_channel *schp = (struct siisata_channel *)chp; | |
@@ -1050,6 +1050,8 @@ siisata_cmd_poll(struct ata_channel *chp | |
SIISATA_DEBUG_PRINT(("%s: %s: done\n", | |
SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), | |
DEBUG_FUNCS); | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
void | |
@@ -1256,7 +1258,7 @@ siisata_bio_start(struct ata_channel *ch | |
return ATASTART_POLL; | |
} | |
-void | |
+int | |
siisata_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct siisata_channel *schp = (struct siisata_channel *)chp; | |
@@ -1280,6 +1282,8 @@ siisata_bio_poll(struct ata_channel *chp | |
SIISATA_DEBUG_PRINT(("%s: %s: done\n", | |
SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), | |
DEBUG_FUNCS); | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
void | |
@@ -1865,7 +1869,7 @@ siisata_atapi_start(struct ata_channel * | |
return ATASTART_POLL; | |
} | |
-void | |
+int | |
siisata_atapi_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
struct siisata_channel *schp = (struct siisata_channel *)chp; | |
@@ -1888,6 +1892,8 @@ siisata_atapi_poll(struct ata_channel *c | |
SIISATA_DEBUG_PRINT(("%s: %s: done\n", | |
SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), | |
DEBUG_FUNCS); | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
void | |
Index: sys/dev/ic/wdc.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/ic/wdc.c,v | |
retrieving revision 1.291.4.1 | |
diff -p -u -r1.291.4.1 wdc.c | |
--- sys/dev/ic/wdc.c 23 Sep 2019 07:09:47 -0000 1.291.4.1 | |
+++ sys/dev/ic/wdc.c 19 Aug 2022 20:41:55 -0000 | |
@@ -148,7 +148,7 @@ static int wdcreset(struct ata_channel * | |
static void __wdcerror(struct ata_channel *, const char *); | |
static int __wdcwait_reset(struct ata_channel *, int, int); | |
static void __wdccommand_done(struct ata_channel *, struct ata_xfer *); | |
-static void __wdccommand_poll(struct ata_channel *, struct ata_xfer *); | |
+static int __wdccommand_poll(struct ata_channel *, struct ata_xfer *); | |
static void __wdccommand_done_end(struct ata_channel *, struct ata_xfer *); | |
static void __wdccommand_kill_xfer(struct ata_channel *, | |
struct ata_xfer *, int); | |
@@ -1498,10 +1498,11 @@ __wdccommand_start(struct ata_channel *c | |
return ATASTART_POLL; | |
} | |
-static void | |
+static int | |
__wdccommand_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
__wdccommand_intr(chp, xfer, 0); | |
+ return ATAPOLL_DONE; | |
} | |
static int | |
Index: sys/dev/scsipi/atapi_wdc.c | |
=================================================================== | |
RCS file: /home/netbsd/src/sys/dev/scsipi/atapi_wdc.c,v | |
retrieving revision 1.133 | |
diff -p -u -r1.133 atapi_wdc.c | |
--- sys/dev/scsipi/atapi_wdc.c 12 Nov 2018 20:54:03 -0000 1.133 | |
+++ sys/dev/scsipi/atapi_wdc.c 19 Aug 2022 20:41:55 -0000 | |
@@ -90,7 +90,7 @@ static int wdc_atapi_intr(struct ata_cha | |
static void wdc_atapi_kill_xfer(struct ata_channel *, | |
struct ata_xfer *, int); | |
static void wdc_atapi_phase_complete(struct ata_xfer *, int); | |
-static void wdc_atapi_poll(struct ata_channel *, struct ata_xfer *); | |
+static int 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 *); | |
static void wdc_atapi_scsipi_request(struct scsipi_channel *, | |
@@ -705,7 +705,7 @@ error: | |
return ATASTART_ABORT; | |
} | |
-static void | |
+static int | |
wdc_atapi_poll(struct ata_channel *chp, struct ata_xfer *xfer) | |
{ | |
/* | |
@@ -720,7 +720,7 @@ wdc_atapi_poll(struct ata_channel *chp, | |
wdc_atapi_intr(chp, xfer, 0); | |
if (!poll) | |
- return; | |
+ return ATAPOLL_DONE; | |
#if NATA_DMA | |
if (chp->ch_flags & ATACH_DMA_WAIT) { | |
@@ -733,6 +733,8 @@ wdc_atapi_poll(struct ata_channel *chp, | |
DELAY(1); | |
wdc_atapi_intr(chp, xfer, 0); | |
} | |
+ | |
+ return ATAPOLL_DONE; | |
} | |
static int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment