Module Name:    src
Committed By:   bouyer
Date:           Mon Aug 20 11:59:29 UTC 2012

Modified Files:
        src/sys/dev/ic: ahcisata_core.c

Log Message:
Fix AHCI_QUIRK_BADPMPRESET: when reset fails for drive 15, stop, clear
errors and restart the channel before retrying with drive 0.
Should fix the problem of drives not detected any more reported by
Markus W Kilbinger on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/ic/ahcisata_core.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.41 src/sys/dev/ic/ahcisata_core.c:1.42
--- src/sys/dev/ic/ahcisata_core.c:1.41	Fri Aug 10 16:35:00 2012
+++ src/sys/dev/ic/ahcisata_core.c	Mon Aug 20 11:59:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.41 2012/08/10 16:35:00 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.41 2012/08/10 16:35:00 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -644,6 +644,7 @@ ahci_do_reset_drive(struct ata_channel *
 	uint32_t sig;
 
 	KASSERT((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_CR) == 0);
+again:
 	/* clear port interrupt register */
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
 	/* clear SErrors and start operations */
@@ -660,7 +661,6 @@ ahci_do_reset_drive(struct ata_channel *
 	if (drive > 0) {
 		KASSERT(sc->sc_ahci_cap & AHCI_CAP_SPM);
 	}
-again:
 	/* polled command, assume interrupts are disabled */
 	/* use slot 0 to send reset, the channel is idle */
 	cmd_h = &achp->ahcic_cmdh[0];
@@ -701,6 +701,7 @@ again:
 			 * try again with port 0
 			 */
 			drive = 0;
+			ahci_channel_stop(sc, chp, flags);
 			goto again;
 		}
 		aprint_error("%s channel %d: clearing WDCTL_RST failed "

Reply via email to