Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Workaround PR kern/47097: use delay() instead of ...



details:   https://anonhg.NetBSD.org/src/rev/aea39741e680
branches:  trunk
changeset: 782286:aea39741e680
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Oct 26 09:59:11 2012 +0000

description:
Workaround PR kern/47097: use delay() instead of tsleep() ahci_do_reset_drive()
if not called with AT_WAIT.
The right fix here is to change the ata layer to reset the drive from
thread context, to avoid a 0.5 delay() in interrupt context when a drive
fails.

diffstat:

 sys/dev/ic/ahcisata_core.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r e5fb6d5ccb48 -r aea39741e680 sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Fri Oct 26 05:28:41 2012 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Fri Oct 26 09:59:11 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.44 2012/09/27 00:39:47 matt Exp $  */
+/*     $NetBSD: ahcisata_core.c,v 1.45 2012/10/26 09:59:11 bouyer Exp $        */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.44 2012/09/27 00:39:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.45 2012/10/26 09:59:11 bouyer Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -721,7 +721,10 @@
                if ((((sig & AHCI_P_TFD_ST) >> AHCI_P_TFD_ST_SHIFT)
                    & WDCS_BSY) == 0)
                        break;
-               tsleep(&sc, PRIBIO, "ahcid2h", mstohz(10));
+               if (flags & AT_WAIT)
+                       tsleep(&sc, PRIBIO, "ahcid2h", mstohz(10));
+               else
+                       delay(10000);
        }
        if (i == AHCI_RST_WAIT) {
                aprint_error("%s: BSY never cleared, TD 0x%x\n",
@@ -740,7 +743,10 @@
            AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel))), DEBUG_PROBE);
 end:
        ahci_channel_stop(sc, chp, flags);
-       tsleep(&sc, PRIBIO, "ahcirst", mstohz(500));
+       if (flags & AT_WAIT)
+               tsleep(&sc, PRIBIO, "ahcirst", mstohz(500));
+       else
+               delay(500000);
        /* clear port interrupt register */
        AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
        ahci_channel_start(sc, chp, AT_WAIT,



Home | Main Index | Thread Index | Old Index