Source-Changes-HG archive

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

[src/jdolecek-ncqfixes]: src/sys/dev/ic further channel locking pass for reset



details:   https://anonhg.NetBSD.org/src/rev/4933adba83ff
branches:  jdolecek-ncqfixes
changeset: 850589:4933adba83ff
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Oct 04 17:59:35 2018 +0000

description:
further channel locking pass for reset

diffstat:

 sys/dev/ic/ahcisata_core.c |  10 +++++-----
 sys/dev/ic/mvsata.c        |   6 ++++--
 sys/dev/ic/siisata.c       |  12 ++++++++----
 3 files changed, 17 insertions(+), 11 deletions(-)

diffs (124 lines):

diff -r 5c14209d529d -r 4933adba83ff sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Thu Oct 04 17:53:23 2018 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Thu Oct 04 17:59:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.62.2.6 2018/10/03 19:20:48 jdolecek Exp $  */
+/*     $NetBSD: ahcisata_core.c,v 1.62.2.7 2018/10/04 17:59:35 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.6 2018/10/03 19:20:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.7 2018/10/04 17:59:35 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -885,7 +885,7 @@
        struct ahci_channel *achp = (struct ahci_channel *)chp;
        int i, tfd;
 
-       ata_channel_lock(chp);
+       ata_channel_lock_owned(chp);
 
        ahci_channel_stop(sc, chp, flags);
        if (sata_reset_interface(chp, sc->sc_ahcit, achp->ahcic_scontrol,
@@ -915,8 +915,6 @@
        /* clear port interrupt register */
        AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
 
-       ata_channel_unlock(chp);
-
        return;
 }
 
@@ -1709,7 +1707,9 @@
                 * transfers.
                 */
 reset:
+               ata_channel_lock(chp);
                ahci_reset_channel(chp, AT_POLL);
+               ata_channel_unlock(chp);
                goto out;
                /* NOTREACHED */
 
diff -r 5c14209d529d -r 4933adba83ff sys/dev/ic/mvsata.c
--- a/sys/dev/ic/mvsata.c       Thu Oct 04 17:53:23 2018 +0000
+++ b/sys/dev/ic/mvsata.c       Thu Oct 04 17:59:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvsata.c,v 1.41.2.5 2018/10/03 19:20:48 jdolecek Exp $ */
+/*     $NetBSD: mvsata.c,v 1.41.2.6 2018/10/04 17:59:35 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.41.2.5 2018/10/03 19:20:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41.2.6 2018/10/04 17:59:35 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -635,7 +635,9 @@
                 * reset the drive. This will also kill all still outstanding
                 * transfers.
                 */
+               ata_channel_lock(chp);
                mvsata_reset_channel(chp, AT_POLL);
+               ata_channel_unlock(chp);
                goto out;
                /* NOTREACHED */
 
diff -r 5c14209d529d -r 4933adba83ff sys/dev/ic/siisata.c
--- a/sys/dev/ic/siisata.c      Thu Oct 04 17:53:23 2018 +0000
+++ b/sys/dev/ic/siisata.c      Thu Oct 04 17:59:35 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.35.6.6 2018/10/03 19:20:48 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.35.6.7 2018/10/04 17:59:35 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.6 2018/10/03 19:20:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.7 2018/10/04 17:59:35 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -686,7 +686,9 @@
                 * transfers.
                 */
 reset:
+               ata_channel_lock(chp);
                siisata_device_reset(chp);
+               ata_channel_unlock(chp);
                goto out;
                /* NOTREACHED */
 
@@ -730,9 +732,9 @@
        int i;
        bool timed_out;
 
-       siisata_reinit_port(chp, drvp->drive);
+       ata_channel_lock_owned(chp);
 
-       ata_channel_lock_owned(chp);
+       siisata_reinit_port(chp, drvp->drive);
 
        /* get a slot for running the command on */
        if (!ata_queue_alloc_slot(chp, &c_slot, ATA_MAX_OPENINGS)) {
@@ -1556,7 +1558,9 @@
        }
        if ((ps & PR_PS_PORT_READY) == 0) {
                printf("%s: timeout waiting for port to be ready\n", __func__);
+               ata_channel_lock(chp);
                siisata_reset_channel(chp, AT_POLL);
+               ata_channel_unlock(chp);
        }
 
        if (chp->ch_ndrives > 1)



Home | Main Index | Thread Index | Old Index