Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/ic Pull up following revision(s) (requested by jm...



details:   https://anonhg.NetBSD.org/src/rev/b0ac6a8224f8
branches:  netbsd-9
changeset: 466532:b0ac6a8224f8
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 24 17:34:33 2019 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #576):

        sys/dev/ic/ahcisata_core.c: revision 1.79

When resetting a drive, if the command list is running and CLO is not
supported, attempt to stop the drive first and fail gracefully if that
fails instead of triggering a KASSERT on DIAGNOSTIC kernels.

diffstat:

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

diffs (47 lines):

diff -r f95b887d0ad4 -r b0ac6a8224f8 sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Tue Dec 24 17:32:20 2019 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Tue Dec 24 17:34:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.75.4.1 2019/10/23 18:06:46 martin Exp $    */
+/*     $NetBSD: ahcisata_core.c,v 1.75.4.2 2019/12/24 17:34:33 martin Exp $    */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.75.4.1 2019/10/23 18:06:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.75.4.2 2019/12/24 17:34:33 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -807,7 +807,7 @@
        struct ahci_cmd_tbl *cmd_tbl;
        struct ahci_cmd_header *cmd_h;
        int i, error = 0;
-       uint32_t sig;
+       uint32_t sig, cmd;
        int noclo_retry = 0;
 
        ata_channel_lock_owned(chp);
@@ -825,6 +825,19 @@
                ahci_channel_start(sc, chp, flags, 1);
        } else {
                /* Can't handle command still running without CLO */
+               cmd = AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel));
+               if ((cmd & AHCI_P_CMD_CR) != 0) {
+                       ahci_channel_stop(sc, chp, flags);
+                       cmd = AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel));
+                       if ((cmd & AHCI_P_CMD_CR) != 0) {
+                               aprint_error("%s port %d: DMA engine busy "
+                                   "for drive %d\n", AHCINAME(sc),
+                                   chp->ch_channel, drive);
+                               error = EBUSY;
+                               goto end;
+                       }
+               }
+
                KASSERT((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_CR) == 0);
 
                ahci_channel_start(sc, chp, flags, 0);



Home | Main Index | Thread Index | Old Index