Author: jkim
Date: Fri Apr  8 19:54:29 2011
New Revision: 220459
URL: http://svn.freebsd.org/changeset/base/220459

Log:
  Refactor DELAYDEBUG as it is only useful for correcting i8254 frequency.

Modified:
  head/sys/x86/isa/clock.c

Modified: head/sys/x86/isa/clock.c
==============================================================================
--- head/sys/x86/isa/clock.c    Fri Apr  8 19:08:48 2011        (r220458)
+++ head/sys/x86/isa/clock.c    Fri Apr  8 19:54:29 2011        (r220459)
@@ -245,6 +245,7 @@ getit(void)
        return ((high << 8) | low);
 }
 
+#ifndef DELAYDEBUG
 static __inline void
 delay_tsc(int n, uint64_t freq)
 {
@@ -280,6 +281,7 @@ delay_timecounter(struct timecounter *tc
                last = u;
        } while (now < end);
 }
+#endif
 
 /*
  * Wait "n" microseconds.
@@ -289,15 +291,23 @@ delay_timecounter(struct timecounter *tc
 void
 DELAY(int n)
 {
-       struct timecounter *tc;
-       uint64_t freq;
        int delta, prev_tick, tick, ticks_left;
-
 #ifdef DELAYDEBUG
        int getit_calls = 1;
        int n1;
        static int state = 0;
-#endif
+
+       if (state == 0) {
+               state = 1;
+               for (n1 = 1; n1 <= 10000000; n1 *= 10)
+                       DELAY(n1);
+               state = 2;
+       }
+       if (state == 1)
+               printf("DELAY(%d)...", n);
+#else
+       struct timecounter *tc;
+       uint64_t freq;
 
        freq = atomic_load_acq_64(&tsc_freq);
        if (freq != 0) {
@@ -309,15 +319,6 @@ DELAY(int n)
                delay_timecounter(tc, n);
                return;
        }
-#ifdef DELAYDEBUG
-       if (state == 0) {
-               state = 1;
-               for (n1 = 1; n1 <= 10000000; n1 *= 10)
-                       DELAY(n1);
-               state = 2;
-       }
-       if (state == 1)
-               printf("DELAY(%d)...", n);
 #endif
        /*
         * Read the counter first, so that the rest of the setup overhead is
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to