Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand/lib int 15h/AH=86h (WAIT) doesn't work p...



details:   https://anonhg.NetBSD.org/src/rev/d7b5b916c244
branches:  trunk
changeset: 746982:d7b5b916c244
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Aug 26 13:28:48 2009 +0000

description:
int 15h/AH=86h (WAIT) doesn't work properly on all hardware and emulators, so
for the countdown use the more coarsely grained sleep implementation based
on int 1ah/AH=00h (GET SYSTEM TIME).

ok ad@

diffstat:

 sys/arch/i386/stand/lib/pcio.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r d0f21c4fb509 -r d7b5b916c244 sys/arch/i386/stand/lib/pcio.c
--- a/sys/arch/i386/stand/lib/pcio.c    Wed Aug 26 11:15:25 2009 +0000
+++ b/sys/arch/i386/stand/lib/pcio.c    Wed Aug 26 13:28:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcio.c,v 1.26 2009/06/29 09:23:16 mbalmer Exp $         */
+/*     $NetBSD: pcio.c,v 1.27 2009/08/26 13:28:48 jmcneill Exp $        */
 
 /*
  * Copyright (c) 1996, 1997
@@ -71,6 +71,20 @@
 
 #define POLL_FREQ 10
 
+static void
+wait(int us)
+{
+       int prev = biosgetsystime();
+       int tgt = prev + (20 * us) / 1000000;
+       int new;
+
+       while ((new = biosgetsystime()) < tgt) {
+               if (new < prev) /* XXX timer wrapped */
+                       break;
+               prev = new;
+       }
+}
+
 #ifdef SUPPORT_SERIAL
 static int
 getcomaddr(int idx)
@@ -346,7 +360,7 @@
                        goto out;
                }
                if (i--)
-                       delay(1000000 / POLL_FREQ);
+                       wait(1000000 / POLL_FREQ);
                else
                        break;
        }



Home | Main Index | Thread Index | Old Index