Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic partially back-off rev. 1.68 - when the drive res...



details:   https://anonhg.NetBSD.org/src/rev/5bef7824f61b
branches:  trunk
changeset: 447465:5bef7824f61b
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Jan 12 15:16:51 2019 +0000

description:
partially back-off rev. 1.68 - when the drive reset for port 15 fails,
on some systems controller isn't actually able to process further commands,
it's really necessary to do explicitely reset for drive 0 too

towards resolution of PR kern/53307

diffstat:

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

diffs (72 lines):

diff -r b97ca3741823 -r 5bef7824f61b sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Sat Jan 12 13:59:53 2019 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Sat Jan 12 15:16:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.72 2018/12/07 22:22:12 jdolecek Exp $      */
+/*     $NetBSD: ahcisata_core.c,v 1.73 2019/01/12 15:16:51 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.72 2018/12/07 22:22:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.73 2019/01/12 15:16:51 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -850,6 +850,8 @@
        case TIMEOUT:
                aprint_error("%s port %d: setting WDCTL_RST failed "
                    "for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
+               if (sigp)
+                       *sigp = 0xffffffff;
                error = EBUSY;
                goto end;
        default:
@@ -875,6 +877,8 @@
        case TIMEOUT:
                aprint_error("%s port %d: clearing WDCTL_RST failed "
                    "for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
+               if (sigp)
+                       *sigp = 0xffffffff;
                error = EBUSY;
                goto end;
        default:
@@ -896,6 +900,8 @@
        if (i == AHCI_RST_WAIT) {
                aprint_error("%s: BSY never cleared, TD 0x%x\n",
                    AHCINAME(sc), sig);
+               if (sigp)
+                       *sigp = 0xffffffff;
                goto end;
        }
        AHCIDEBUG_PRINT(("%s: BSY took %d ms\n", AHCINAME(sc), i * 10),
@@ -994,6 +1000,7 @@
                return;
        }
 
+again:
        /* bring interface up, accept FISs, power up and spin up device */
        AHCI_WRITE(sc, AHCI_P_CMD(chp->ch_channel),
            AHCI_P_CMD_ICC_AC | AHCI_P_CMD_FRE |
@@ -1004,9 +1011,6 @@
        case SStatus_DET_DEV:
                ata_delay(chp, 500, "ahcidv", AT_WAIT);
 
-               /* Initial value, used in case the soft reset fails */
-               sig = AHCI_READ(sc, AHCI_P_SIG(chp->ch_channel));
-
                if (sc->sc_ahci_cap & AHCI_CAP_SPM) {
                        error = ahci_do_reset_drive(chp, PMP_PORT_CTL, AT_WAIT,
                            &sig, c_slot);
@@ -1019,7 +1023,7 @@
                                PMP_PORT_CTL);
 
                                sc->sc_ahci_cap &= ~AHCI_CAP_SPM;
-                               ahci_reset_channel(chp, AT_WAIT);
+                               goto again;
                        }
                } else {
                        ahci_do_reset_drive(chp, 0, AT_WAIT, &sig, c_slot);



Home | Main Index | Thread Index | Old Index