Module Name:    src
Committed By:   jmcneill
Date:           Wed Aug 26 13:28:48 UTC 2009

Modified Files:
        src/sys/arch/i386/stand/lib: pcio.c

Log Message:
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@


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/stand/lib/pcio.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/arch/i386/stand/lib/pcio.c
diff -u src/sys/arch/i386/stand/lib/pcio.c:1.26 src/sys/arch/i386/stand/lib/pcio.c:1.27
--- src/sys/arch/i386/stand/lib/pcio.c:1.26	Mon Jun 29 09:23:16 2009
+++ src/sys/arch/i386/stand/lib/pcio.c	Wed Aug 26 13:28:48 2009
@@ -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;
 	}

Reply via email to