Source-Changes-HG archive

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

[src/jdolecek-ncqfixes]: src/sys/dev/ata hold lock during drive reset (new lo...



details:   https://anonhg.NetBSD.org/src/rev/24ac31c10217
branches:  jdolecek-ncqfixes
changeset: 1025104:24ac31c10217
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Oct 20 21:08:23 2018 +0000

description:
hold lock during drive reset (new locking protocol)

erase xfer before each reuse for read/write port commands

diffstat:

 sys/dev/ata/satapmp_subr.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 72e2c28b62d2 -r 24ac31c10217 sys/dev/ata/satapmp_subr.c
--- a/sys/dev/ata/satapmp_subr.c        Wed Oct 17 18:03:26 2018 +0000
+++ b/sys/dev/ata/satapmp_subr.c        Sat Oct 20 21:08:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: satapmp_subr.c,v 1.14.2.1 2018/09/22 09:22:59 jdolecek Exp $   */
+/*     $NetBSD: satapmp_subr.c,v 1.14.2.2 2018/10/20 21:08:23 jdolecek Exp $   */
 
 /*
  * Copyright (c) 2012 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: satapmp_subr.c,v 1.14.2.1 2018/09/22 09:22:59 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: satapmp_subr.c,v 1.14.2.2 2018/10/20 21:08:23 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,6 +62,7 @@
        KASSERT(drvp->drive == PMP_PORT_CTL);
        ata_channel_lock_owned(chp);
 
+       memset(xfer, 0, sizeof(*xfer));
        xfer->c_ata_c.r_command = PMPC_READ_PORT;
        xfer->c_ata_c.r_features = reg;
        xfer->c_ata_c.r_device = port;
@@ -133,6 +134,7 @@
        KASSERT(drvp->drive == PMP_PORT_CTL);
        ata_channel_lock_owned(chp);
 
+       memset(xfer, 0, sizeof(*xfer));
        xfer->c_ata_c.r_command = PMPC_WRITE_PORT;
        xfer->c_ata_c.r_features = reg;
        xfer->c_ata_c.r_device = port;
@@ -261,10 +263,10 @@
                            device_xname(chp->atabus), i);
                        continue;
                }
-               ata_channel_unlock(chp);
+
+               ata_channel_lock_owned(chp);
                chp->ch_atac->atac_bustype_ata->ata_reset_drive(
                    &chp->ch_drive[i], AT_WAIT, &sig);
-               ata_channel_lock(chp);
 
                sata_interpret_sig(chp, i, sig);
        }



Home | Main Index | Thread Index | Old Index