Module Name:    src
Committed By:   sborrill
Date:           Sun Mar  7 08:52:21 UTC 2010

Modified Files:
        src/sys/dev/ic [netbsd-5]: ahcisata_core.c

Log Message:
Backout ticket 1317 until problems reported in -current are fixed:
http://mail-index.netbsd.org/current-users/2010/03/04/msg012810.html


To generate a diff of this commit:
cvs rdiff -u -r1.18.4.2 -r1.18.4.3 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.18.4.2 src/sys/dev/ic/ahcisata_core.c:1.18.4.3
--- src/sys/dev/ic/ahcisata_core.c:1.18.4.2	Sat Mar  6 22:10:46 2010
+++ src/sys/dev/ic/ahcisata_core.c	Sun Mar  7 08:52:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.18.4.2 2010/03/06 22:10:46 sborrill Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.18.4.3 2010/03/07 08:52:21 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.18.4.2 2010/03/06 22:10:46 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.18.4.3 2010/03/07 08:52:21 sborrill Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -510,6 +510,7 @@
 		chp->ch_queue->active_xfer->c_kill_xfer(chp,
 		    chp->ch_queue->active_xfer, KILL_RESET);
 	}
+	ahci_channel_start(sc, chp);
 	/* wait 31s for BSY to clear */
 	for (i = 0; i <3100; i++) {
 		tfd = AHCI_READ(sc, AHCI_P_TFD(chp->ch_channel));
@@ -525,8 +526,6 @@
 	    DEBUG_PROBE);
 	/* clear port interrupt register */
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
-	/* and start channel */
-	ahci_channel_start(sc, chp);
 
 	return;
 }
@@ -571,6 +570,8 @@
 	switch (sata_reset_interface(chp, sc->sc_ahcit, achp->ahcic_scontrol,
 	    achp->ahcic_sstatus)) {
 	case SStatus_DET_DEV:
+		/* clear SErrors and start operations */
+		ahci_channel_start(sc, chp);
 		/* wait 31s for BSY to clear */
 		for (i = 0; i <3100; i++) {
 			sig = AHCI_READ(sc, AHCI_P_TFD(chp->ch_channel));
@@ -579,11 +580,9 @@
 				break;
 			tsleep(&sc, PRIBIO, "ahcid2h", mstohz(10));
 		}
-		if (i == 1500) {
+		if (i == 1500)
 			aprint_error("%s: BSY never cleared, TD 0x%x\n",
 			    AHCINAME(sc), sig);
-			return;
-		}
 		AHCIDEBUG_PRINT(("%s: BSY took %d ms\n", AHCINAME(sc), i * 10),
 		    DEBUG_PROBE);
 		sig = AHCI_READ(sc, AHCI_P_SIG(chp->ch_channel));
@@ -600,11 +599,7 @@
 		} else
 			chp->ch_drive[0].drive_flags |= DRIVE_ATA;
 		splx(s);
-		/* clear port interrupt register */
-		AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
-		/* start channel */
-		ahci_channel_start(sc, chp);
-		/* and enable interrupts */
+		/* enable interrupts */
 		AHCI_WRITE(sc, AHCI_P_IE(chp->ch_channel),
 		    AHCI_P_IX_TFES | AHCI_P_IX_HBFS | AHCI_P_IX_IFS |
 		    AHCI_P_IX_OFS | AHCI_P_IX_DPS | AHCI_P_IX_UFS |

Reply via email to