Module Name:    src
Committed By:   jdolecek
Date:           Fri Jan 18 19:16:50 UTC 2019

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

Log Message:
revert rev 1.73 - while it apparently helped Christos case, it re-broke
the disk detection on several other systems, so need something else


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 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.73 src/sys/dev/ic/ahcisata_core.c:1.74
--- src/sys/dev/ic/ahcisata_core.c:1.73	Sat Jan 12 15:16:51 2019
+++ src/sys/dev/ic/ahcisata_core.c	Fri Jan 18 19:16:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.73 2019/01/12 15:16:51 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.74 2019/01/18 19:16:50 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.73 2019/01/12 15:16:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.74 2019/01/18 19:16:50 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -850,8 +850,6 @@ ahci_do_reset_drive(struct ata_channel *
 	case TIMEOUT:
 		aprint_error("%s port %d: setting WDCTL_RST failed "
 		    "for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
-		if (sigp)
-			*sigp = 0xffffffff;
 		error = EBUSY;
 		goto end;
 	default:
@@ -877,8 +875,6 @@ ahci_do_reset_drive(struct ata_channel *
 	case TIMEOUT:
 		aprint_error("%s port %d: clearing WDCTL_RST failed "
 		    "for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
-		if (sigp)
-			*sigp = 0xffffffff;
 		error = EBUSY;
 		goto end;
 	default:
@@ -900,8 +896,6 @@ skip_reset:
 	if (i == AHCI_RST_WAIT) {
 		aprint_error("%s: BSY never cleared, TD 0x%x\n",
 		    AHCINAME(sc), sig);
-		if (sigp)
-			*sigp = 0xffffffff;
 		goto end;
 	}
 	AHCIDEBUG_PRINT(("%s: BSY took %d ms\n", AHCINAME(sc), i * 10),
@@ -1000,7 +994,6 @@ ahci_probe_drive(struct ata_channel *chp
 		return;
 	}
 
-again:
 	/* bring interface up, accept FISs, power up and spin up device */
 	AHCI_WRITE(sc, AHCI_P_CMD(chp->ch_channel),
 	    AHCI_P_CMD_ICC_AC | AHCI_P_CMD_FRE |
@@ -1011,6 +1004,9 @@ again:
 	case SStatus_DET_DEV:
 		ata_delay(chp, 500, "ahcidv", AT_WAIT);
 
+		/* Initial value, used in case the soft reset fails */
+		sig = AHCI_READ(sc, AHCI_P_SIG(chp->ch_channel));
+
 		if (sc->sc_ahci_cap & AHCI_CAP_SPM) {
 			error = ahci_do_reset_drive(chp, PMP_PORT_CTL, AT_WAIT,
 			    &sig, c_slot);
@@ -1023,7 +1019,7 @@ again:
 				PMP_PORT_CTL);
 
 				sc->sc_ahci_cap &= ~AHCI_CAP_SPM;
-				goto again;
+				ahci_reset_channel(chp, AT_WAIT);
 			}
 		} else {
 			ahci_do_reset_drive(chp, 0, AT_WAIT, &sig, c_slot);

Reply via email to