Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Apr 2011 19:54:29 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220459 - head/sys/x86/isa
Message-ID:  <201104081954.p38JsTED090284@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104081954.p38JsTED090284>