Module Name:    src
Committed By:   bouyer
Date:           Tue May 15 19:01:10 UTC 2012

Modified Files:
        src/sys/dev/ata: sata_subr.c

Log Message:
If the PHY reports link up but no communication, wait 5 more
seconds for communications to be established. This seems to be needed for
some configurations.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ata/sata_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/sata_subr.c
diff -u src/sys/dev/ata/sata_subr.c:1.14 src/sys/dev/ata/sata_subr.c:1.15
--- src/sys/dev/ata/sata_subr.c:1.14	Sun Dec 12 00:38:07 2010
+++ src/sys/dev/ata/sata_subr.c	Tue May 15 19:01:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sata_subr.c,v 1.14 2010/12/12 00:38:07 jakllsch Exp $	*/
+/*	$NetBSD: sata_subr.c,v 1.15 2012/05/15 19:01:10 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  * Common functions for Serial ATA.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.14 2010/12/12 00:38:07 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.15 2012/05/15 19:01:10 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -105,6 +105,18 @@ sata_reset_interface(struct ata_channel 
 			break;
 		tsleep(chp, PRIBIO, "sataup", mstohz(10));
 	}
+	/*
+	 * if we have a link up without device, wait a few more seconds
+	 * for connection to establish
+	 */
+	if ((sstatus & SStatus_DET_mask) == SStatus_DET_DEV_NE) {
+		for (i = 0; i < 500; i++) {
+			tsleep(chp, PRIBIO, "sataup", mstohz(10));
+			sstatus = bus_space_read_4(sata_t, sstatus_r, 0);
+			if ((sstatus & SStatus_DET_mask) == SStatus_DET_DEV)
+				break;
+		}
+	}
 
 	switch (sstatus & SStatus_DET_mask) {
 	case SStatus_DET_NODEV:

Reply via email to