From owner-svn-src-all@FreeBSD.ORG Fri Apr 8 19:54:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 216A9106566B; Fri, 8 Apr 2011 19:54:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FEE98FC17; Fri, 8 Apr 2011 19:54:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p38JsT5P090286; Fri, 8 Apr 2011 19:54:29 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p38JsTED090284; Fri, 8 Apr 2011 19:54:29 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201104081954.p38JsTED090284@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 8 Apr 2011 19:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220459 - head/sys/x86/isa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2011 19:54:30 -0000 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