Module Name:    src
Committed By:   jdolecek
Date:           Thu Oct  4 17:59:35 UTC 2018

Modified Files:
        src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c mvsata.c siisata.c

Log Message:
further channel locking pass for reset


To generate a diff of this commit:
cvs rdiff -u -r1.62.2.6 -r1.62.2.7 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.41.2.5 -r1.41.2.6 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.35.6.6 -r1.35.6.7 src/sys/dev/ic/siisata.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.62.2.6 src/sys/dev/ic/ahcisata_core.c:1.62.2.7
--- src/sys/dev/ic/ahcisata_core.c:1.62.2.6	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ic/ahcisata_core.c	Thu Oct  4 17:59:35 2018
@@ -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 @@ ahci_reset_channel(struct ata_channel *c
 	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 @@ ahci_reset_channel(struct ata_channel *c
 	/* clear port interrupt register */
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
 
-	ata_channel_unlock(chp);
-
 	return;
 }
 
@@ -1709,7 +1707,9 @@ ahci_channel_recover(struct ahci_softc *
 		 * transfers.
 		 */
 reset:
+		ata_channel_lock(chp);
 		ahci_reset_channel(chp, AT_POLL);
+		ata_channel_unlock(chp);
 		goto out;
 		/* NOTREACHED */
 

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.41.2.5 src/sys/dev/ic/mvsata.c:1.41.2.6
--- src/sys/dev/ic/mvsata.c:1.41.2.5	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ic/mvsata.c	Thu Oct  4 17:59:35 2018
@@ -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 @@ mvsata_channel_recover(struct mvsata_por
 		 * 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 */
 

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.35.6.6 src/sys/dev/ic/siisata.c:1.35.6.7
--- src/sys/dev/ic/siisata.c:1.35.6.6	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ic/siisata.c	Thu Oct  4 17:59:35 2018
@@ -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 @@ siisata_channel_recover(struct ata_chann
 		 * transfers.
 		 */
 reset:
+		ata_channel_lock(chp);
 		siisata_device_reset(chp);
+		ata_channel_unlock(chp);
 		goto out;
 		/* NOTREACHED */
 
@@ -730,10 +732,10 @@ siisata_reset_drive(struct ata_drive_dat
 	int i;
 	bool timed_out;
 
-	siisata_reinit_port(chp, drvp->drive);
-
 	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)) {
 		panic("%s: %s: failed to get xfer for reset, port %d\n",
@@ -1556,7 +1558,9 @@ siisata_reinit_port(struct ata_channel *
 	}
 	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)

Reply via email to