Module Name: src
Committed By: jdolecek
Date: Sat Oct 20 21:08:23 UTC 2018
Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: satapmp_subr.c
Log Message:
hold lock during drive reset (new locking protocol)
erase xfer before each reuse for read/write port commands
To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/ata/satapmp_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ata/satapmp_subr.c
diff -u src/sys/dev/ata/satapmp_subr.c:1.14.2.1 src/sys/dev/ata/satapmp_subr.c:1.14.2.2
--- src/sys/dev/ata/satapmp_subr.c:1.14.2.1 Sat Sep 22 09:22:59 2018
+++ src/sys/dev/ata/satapmp_subr.c Sat Oct 20 21:08:23 2018
@@ -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 @@ satapmp_read_8(struct ata_channel *chp,
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 @@ satapmp_write_8(struct ata_channel *chp,
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 @@ satapmp_rescan(struct ata_channel *chp,
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);
}