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 Add wait_sec() which uses BIOS funct...



details:   https://anonhg.NetBSD.org/src/rev/867f68a103fb
branches:  trunk
changeset: 755857:867f68a103fb
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Jun 25 15:35:08 2010 +0000

description:
Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.

diffstat:

 sys/arch/i386/stand/lib/biosdisk.c |  4 ++--
 sys/arch/i386/stand/lib/exec.c     |  8 ++++----
 sys/arch/i386/stand/lib/libi386.h  |  3 ++-
 sys/arch/i386/stand/lib/pcio.c     |  9 ++++++++-
 sys/arch/i386/stand/lib/vbe.c      |  4 ++--
 5 files changed, 18 insertions(+), 10 deletions(-)

diffs (109 lines):

diff -r 544682510e7b -r 867f68a103fb sys/arch/i386/stand/lib/biosdisk.c
--- a/sys/arch/i386/stand/lib/biosdisk.c        Fri Jun 25 15:16:13 2010 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.c        Fri Jun 25 15:35:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biosdisk.c,v 1.30 2009/10/20 14:49:03 jmcneill Exp $   */
+/*     $NetBSD: biosdisk.c,v 1.31 2010/06/25 15:35:08 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1996, 1998
@@ -509,7 +509,7 @@
 
        /* let the floppy drive go off */
        if (d->ll.type == BIOSDISK_TYPE_FD)
-               delay(3000000); /* 2s is enough on all PCs I found */
+               wait_sec(3);    /* 2s is enough on all PCs I found */
 
        dealloc(d, sizeof(struct biosdisk));
        f->f_devdata = NULL;
diff -r 544682510e7b -r 867f68a103fb sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c    Fri Jun 25 15:16:13 2010 +0000
+++ b/sys/arch/i386/stand/lib/exec.c    Fri Jun 25 15:35:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec.c,v 1.42 2009/09/14 11:56:27 jmcneill Exp $        */
+/*     $NetBSD: exec.c,v 1.43 2010/06/25 15:35:08 tsutsui Exp $         */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
 #define        PAGE_SIZE       4096
 #endif
 
-#define MODULE_WARNING_DELAY   5000000
+#define MODULE_WARNING_SEC     5
 
 extern struct btinfo_console btinfo_console;
 
@@ -486,7 +486,7 @@
        btinfo_modulelist = alloc(len);
        if (btinfo_modulelist == NULL) {
                printf("WARNING: couldn't allocate module list\n");
-               delay(MODULE_WARNING_DELAY);
+               wait_sec(MODULE_WARNING_SEC);
                return;
        }
        memset(btinfo_modulelist, 0, len);
@@ -530,7 +530,7 @@
                printf("WARNING: %d module%s failed to load\n",
                    nfail, nfail == 1 ? "" : "s");
 #if notyet
-               delay(MODULE_WARNING_DELAY);
+               wait_sec(MODULE_WARNING_SEC);
 #endif
        }
 }
diff -r 544682510e7b -r 867f68a103fb sys/arch/i386/stand/lib/libi386.h
--- a/sys/arch/i386/stand/lib/libi386.h Fri Jun 25 15:16:13 2010 +0000
+++ b/sys/arch/i386/stand/lib/libi386.h Fri Jun 25 15:35:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libi386.h,v 1.32 2009/09/13 22:45:27 jmcneill Exp $    */
+/*     $NetBSD: libi386.h,v 1.33 2010/06/25 15:35:08 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1996
@@ -69,6 +69,7 @@
 #define CONSDEV_AUTO (-1)
 int iskey(int);
 char awaitkey(int, int);
+void wait_sec(int);
 
 /* this is in "user code"! */
 int parsebootfile(const char *, char **, char **, int *, int *, const char **);
diff -r 544682510e7b -r 867f68a103fb sys/arch/i386/stand/lib/pcio.c
--- a/sys/arch/i386/stand/lib/pcio.c    Fri Jun 25 15:16:13 2010 +0000
+++ b/sys/arch/i386/stand/lib/pcio.c    Fri Jun 25 15:35:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcio.c,v 1.27 2009/08/26 13:28:48 jmcneill Exp $        */
+/*     $NetBSD: pcio.c,v 1.28 2010/06/25 15:35:08 tsutsui Exp $         */
 
 /*
  * Copyright (c) 1996, 1997
@@ -371,3 +371,10 @@
 
        return c;
 }
+
+void
+wait_sec(int sec)
+{
+
+       wait(sec * 1000000);
+}
diff -r 544682510e7b -r 867f68a103fb sys/arch/i386/stand/lib/vbe.c
--- a/sys/arch/i386/stand/lib/vbe.c     Fri Jun 25 15:16:13 2010 +0000
+++ b/sys/arch/i386/stand/lib/vbe.c     Fri Jun 25 15:35:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.5 2009/10/20 14:47:33 jmcneill Exp $ */
+/* $NetBSD: vbe.c,v 1.6 2010/06/25 15:35:08 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -172,7 +172,7 @@
                if (ret) {
                        printf("WARNING: failed to set VBE mode 0x%x\n",
                            vbestate.modenum);
-                       delay(5000000);
+                       wait_sec(5);
                }
        }
        return ret;



Home | Main Index | Thread Index | Old Index