Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/stand/altboot When a drive is present, re...



details:   https://anonhg.NetBSD.org/src/rev/0480be760d5a
branches:  trunk
changeset: 765573:0480be760d5a
user:      phx <phx%NetBSD.org@localhost>
date:      Mon May 30 19:48:12 2011 +0000

description:
When a drive is present, retry ATA-reset for a maximum of 10 seconds, until
successful.

diffstat:

 sys/arch/sandpoint/stand/altboot/siisata.c |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (47 lines):

diff -r 61218ba79d57 -r 0480be760d5a sys/arch/sandpoint/stand/altboot/siisata.c
--- a/sys/arch/sandpoint/stand/altboot/siisata.c        Mon May 30 19:31:19 2011 +0000
+++ b/sys/arch/sandpoint/stand/altboot/siisata.c        Mon May 30 19:48:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.3 2011/03/06 13:55:12 phx Exp $ */
+/* $NetBSD: siisata.c,v 1.4 2011/05/30 19:48:12 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
 siisata_init(unsigned tag, void *data)
 {
        unsigned idreg;
-       int nchan, n;
+       int n, nchan, retries;
        struct dkdev_ata *l;
 
        l = alloc(sizeof(struct dkdev_ata));
@@ -99,15 +99,22 @@
        pcicfgwrite(tag, 0x80, 0x00);
        pcicfgwrite(tag, 0x84, 0x00);
 
-       for (n = 0; n < nchan; n++) {
+       for (n = 0, retries = 0; n < nchan; n++) {
+               l->presense[n] = 0;
+
                if (satapresense(l, n)) {
                        /* drive present, now check whether soft reset works */
-                       if (perform_atareset(l, n)) {
-                               DPRINTF(("port %d device present\n", n));
-                               l->presense[n] = 1;
+                       while (retries++ < 10) {
+                               if (perform_atareset(l, n)) {
+                                       DPRINTF(("port %d device present\n", n));
+                                       l->presense[n] = 1;
+                                       break;
+                               }
+                               /* give the drive another second to spin up */
+                               if (retries < 10)
+                                       delay(1000 * 1000);
                        }
-               } else
-                       l->presense[n] = 0;
+               }
        }
        return l;
 }



Home | Main Index | Thread Index | Old Index