Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncq]: src/sys/dev/ic fix confusion around AT_WAIT vs AT_POLL fo...
details: https://anonhg.NetBSD.org/src/rev/59c2556eb87c
branches: jdolecek-ncq
changeset: 352697:59c2556eb87c
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Jun 24 14:59:10 2017 +0000
description:
fix confusion around AT_WAIT vs AT_POLL for mvsata_edma_disable(), and switch
all the tsleep()/delay() ifs to just use ata_delay()
diffstat:
sys/dev/ic/mvsata.c | 36 ++++++++++--------------------------
1 files changed, 10 insertions(+), 26 deletions(-)
diffs (102 lines):
diff -r dcbe2fcb2e6e -r 59c2556eb87c sys/dev/ic/mvsata.c
--- a/sys/dev/ic/mvsata.c Sat Jun 24 14:57:17 2017 +0000
+++ b/sys/dev/ic/mvsata.c Sat Jun 24 14:59:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvsata.c,v 1.35.6.15 2017/06/24 14:33:06 jdolecek Exp $ */
+/* $NetBSD: mvsata.c,v 1.35.6.16 2017/06/24 14:59:10 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.35.6.15 2017/06/24 14:33:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.16 2017/06/24 14:59:10 jdolecek Exp $");
#include "opt_mvsata.h"
@@ -1081,7 +1081,7 @@
struct wdc_softc *wdc = CHAN_TO_WDC(chp);
struct ata_bio *ata_bio = &xfer->c_bio;
struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
- int wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0;
+ int wait_flags = ata_bio->flags & AT_WAIT;
u_int16_t cyl;
u_int8_t head, sect, cmd = 0;
int nblks, error;
@@ -3206,10 +3206,10 @@
#define WDCNDELAY_RST (WDC_RESET_WAIT * 1000 / WDCDELAY)
static uint32_t
-mvsata_softreset(struct mvsata_port *mvport, int waitok)
+mvsata_softreset(struct mvsata_port *mvport, int flags)
{
uint32_t sig0 = ~0;
- int timeout, nloop;
+ int timeout;
uint8_t st0;
MVSATA_WDC_WRITE_1(mvport, SRB_CAS, WDCTL_RST | WDCTL_IDS | WDCTL_4BIT);
@@ -3218,13 +3218,8 @@
MVSATA_WDC_WRITE_1(mvport, SRB_CAS, WDCTL_IDS | WDCTL_4BIT);
delay(10);
- if (!waitok)
- nloop = WDCNDELAY_RST;
- else
- nloop = WDC_RESET_WAIT * hz / 1000;
-
/* wait for BSY to deassert */
- for (timeout = 0; timeout < nloop; timeout++) {
+ for (timeout = 0; timeout < WDCNDELAY_RST; timeout++) {
st0 = MVSATA_WDC_READ_1(mvport, SRB_CS);
if ((st0 & WDCS_BSY) == 0) {
@@ -3234,10 +3229,7 @@
sig0 |= MVSATA_WDC_READ_1(mvport, SRB_LBAH) << 24;
goto out;
}
- if (!waitok)
- delay(WDCDELAY);
- else
- tsleep(&nloop, PRIBIO, "atarst", 1);
+ ata_delay(WDCDELAY, "atarst", flags);
}
out:
@@ -3270,7 +3262,7 @@
}
static int
-mvsata_edma_disable(struct mvsata_port *mvport, int timeout, int waitok)
+mvsata_edma_disable(struct mvsata_port *mvport, int timeout, int wflags)
{
uint32_t status, command;
int ms;
@@ -3280,11 +3272,7 @@
status = MVSATA_EDMA_READ_4(mvport, EDMA_S);
if (status & EDMA_S_EDMAIDLE)
break;
- if (waitok)
- tsleep(&waitok, PRIBIO, "mvsata_edma1",
- mstohz(1));
- else
- delay(1000);
+ ata_delay(1, "mvsata_edma1", wflags);
}
if (ms == timeout) {
aprint_error("%s:%d:%d: unable to disable EDMA\n",
@@ -3300,11 +3288,7 @@
command = MVSATA_EDMA_READ_4(mvport, EDMA_CMD);
if (!(command & EDMA_CMD_EENEDMA))
break;
- if (waitok)
- tsleep(&waitok, PRIBIO, "mvsata_edma2",
- mstohz(1));
- else
- delay(1000);
+ ata_delay(1, "mvsata_edma2", wflags);
}
if (ms == timeout) {
aprint_error("%s:%d:%d: unable to re-enable EDMA\n",
Home |
Main Index |
Thread Index |
Old Index