Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata If the PHY reports link up but no communication, ...



details:   https://anonhg.NetBSD.org/src/rev/ed22880eba4c
branches:  trunk
changeset: 779288:ed22880eba4c
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue May 15 19:01:10 2012 +0000

description:
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.

diffstat:

 sys/dev/ata/sata_subr.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 788a79248c1e -r ed22880eba4c sys/dev/ata/sata_subr.c
--- a/sys/dev/ata/sata_subr.c   Tue May 15 18:46:20 2012 +0000
+++ b/sys/dev/ata/sata_subr.c   Tue May 15 19:01:10 2012 +0000
@@ -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 @@
                        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:



Home | Main Index | Thread Index | Old Index