From owner-svn-src-head@FreeBSD.ORG Thu Mar 10 20:02:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B06BC106566B; Thu, 10 Mar 2011 20:02:58 +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 967A88FC15; Thu, 10 Mar 2011 20:02:58 +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 p2AK2wDi054461; Thu, 10 Mar 2011 20:02:58 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2AK2w1M054449; Thu, 10 Mar 2011 20:02:58 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201103102002.p2AK2w1M054449@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 10 Mar 2011 20:02:58 +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: r219461 - in head/sys: amd64/amd64 amd64/include contrib/altq/altq i386/i386 i386/include i386/isa pc98/pc98 x86/isa x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2011 20:02:58 -0000 Author: jkim Date: Thu Mar 10 20:02:58 2011 New Revision: 219461 URL: http://svn.freebsd.org/changeset/base/219461 Log: Deprecate rarely used tsc_is_broken. Instead, we zero out tsc_freq because it is almost always used with tsc_freq any way. Modified: head/sys/amd64/amd64/identcpu.c head/sys/amd64/amd64/prof_machdep.c head/sys/amd64/include/clock.h head/sys/contrib/altq/altq/altq_subr.c head/sys/i386/i386/identcpu.c head/sys/i386/i386/machdep.c head/sys/i386/include/clock.h head/sys/i386/isa/prof_machdep.c head/sys/pc98/pc98/machdep.c head/sys/x86/isa/clock.c head/sys/x86/x86/tsc.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/amd64/amd64/identcpu.c Thu Mar 10 20:02:58 2011 (r219461) @@ -193,10 +193,12 @@ printcpuinfo(void) printf("%s (", cpu_model); switch(cpu_class) { case CPUCLASS_K8: - hw_clockrate = (tsc_freq + 5000) / 1000000; - printf("%jd.%02d-MHz ", - (intmax_t)(tsc_freq + 4999) / 1000000, - (u_int)((tsc_freq + 4999) / 10000) % 100); + if (tsc_freq != 0) { + hw_clockrate = (tsc_freq + 5000) / 1000000; + printf("%jd.%02d-MHz ", + (intmax_t)(tsc_freq + 4999) / 1000000, + (u_int)((tsc_freq + 4999) / 10000) % 100); + } printf("K8"); break; default: Modified: head/sys/amd64/amd64/prof_machdep.c ============================================================================== --- head/sys/amd64/amd64/prof_machdep.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/amd64/amd64/prof_machdep.c Thu Mar 10 20:02:58 2011 (r219461) @@ -319,7 +319,7 @@ startguprof(gp) if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) { cputime_clock = CPUTIME_CLOCK_I8254; #if defined(I586_CPU) || defined(I686_CPU) - if (tsc_freq != 0 && !tsc_is_broken && mp_ncpus == 1) + if (tsc_freq != 0 && mp_ncpus == 1) cputime_clock = CPUTIME_CLOCK_TSC; #endif } Modified: head/sys/amd64/include/clock.h ============================================================================== --- head/sys/amd64/include/clock.h Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/amd64/include/clock.h Thu Mar 10 20:02:58 2011 (r219461) @@ -18,7 +18,6 @@ extern int clkintr_pending; extern u_int i8254_freq; extern int i8254_max_count; extern uint64_t tsc_freq; -extern int tsc_is_broken; extern int tsc_is_invariant; void i8254_init(void); Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/contrib/altq/altq/altq_subr.c Thu Mar 10 20:02:58 2011 (r219461) @@ -79,10 +79,8 @@ #endif #if defined(__amd64__) || defined(__i386__) #include /* for pentium tsc */ +#if defined(__NetBSD__) || defined(__OpenBSD__) #include /* for CPUID_TSC */ -#ifdef __FreeBSD__ -#include /* for cpu_feature */ -#elif defined(__NetBSD__) || defined(__OpenBSD__) #include /* for cpu_feature */ #endif #endif /* __amd64 || __i386__ */ @@ -928,8 +926,11 @@ init_machclk_setup(void) #endif #if defined(__amd64__) || defined(__i386__) /* check if TSC is available */ - if (machclk_usepcc == 1 && ((cpu_feature & CPUID_TSC) == 0 || - tsc_is_broken)) +#ifdef __FreeBSD__ + if (tsc_freq == 0) +#else + if ((cpu_feature & CPUID_TSC) == 0) +#endif machclk_usepcc = 0; #endif } Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/i386/i386/identcpu.c Thu Mar 10 20:02:58 2011 (r219461) @@ -372,7 +372,7 @@ printcpuinfo(void) break; case 0x500: strcat(cpu_model, "K5 model 0"); - tsc_is_broken = 1; + tsc_freq = 0; break; case 0x510: strcat(cpu_model, "K5 model 1"); @@ -570,7 +570,7 @@ printcpuinfo(void) switch (cpu_id & 0xff0) { case 0x540: strcpy(cpu_model, "IDT WinChip C6"); - tsc_is_broken = 1; + tsc_freq = 0; break; case 0x580: strcpy(cpu_model, "IDT WinChip 2"); @@ -607,7 +607,7 @@ printcpuinfo(void) case 0x540: strcpy(cpu_model, "Geode SC1100"); cpu = CPU_GEODE1100; - tsc_is_broken = 1; + tsc_freq = 0; break; default: strcpy(cpu_model, "Geode/NSC unknown"); @@ -640,19 +640,23 @@ printcpuinfo(void) #endif #if defined(I586_CPU) case CPUCLASS_586: - hw_clockrate = (tsc_freq + 5000) / 1000000; - printf("%jd.%02d-MHz ", - (intmax_t)(tsc_freq + 4999) / 1000000, - (u_int)((tsc_freq + 4999) / 10000) % 100); + if (tsc_freq != 0) { + hw_clockrate = (tsc_freq + 5000) / 1000000; + printf("%jd.%02d-MHz ", + (intmax_t)(tsc_freq + 4999) / 1000000, + (u_int)((tsc_freq + 4999) / 10000) % 100); + } printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: - hw_clockrate = (tsc_freq + 5000) / 1000000; - printf("%jd.%02d-MHz ", - (intmax_t)(tsc_freq + 4999) / 1000000, - (u_int)((tsc_freq + 4999) / 10000) % 100); + if (tsc_freq != 0) { + hw_clockrate = (tsc_freq + 5000) / 1000000; + printf("%jd.%02d-MHz ", + (intmax_t)(tsc_freq + 4999) / 1000000, + (u_int)((tsc_freq + 4999) / 10000) % 100); + } printf("686"); break; #endif Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/i386/i386/machdep.c Thu Mar 10 20:02:58 2011 (r219461) @@ -1172,7 +1172,7 @@ cpu_est_clockrate(int cpu_id, uint64_t * #endif tsc2 -= tsc1; - if (tsc_freq != 0 && !tsc_is_broken) { + if (tsc_freq != 0) { *rate = tsc2 * 1000; return (0); } Modified: head/sys/i386/include/clock.h ============================================================================== --- head/sys/i386/include/clock.h Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/i386/include/clock.h Thu Mar 10 20:02:58 2011 (r219461) @@ -18,7 +18,6 @@ extern int clkintr_pending; extern u_int i8254_freq; extern int i8254_max_count; extern uint64_t tsc_freq; -extern int tsc_is_broken; extern int tsc_is_invariant; void i8254_init(void); Modified: head/sys/i386/isa/prof_machdep.c ============================================================================== --- head/sys/i386/isa/prof_machdep.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/i386/isa/prof_machdep.c Thu Mar 10 20:02:58 2011 (r219461) @@ -289,7 +289,7 @@ startguprof(gp) if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) { cputime_clock = CPUTIME_CLOCK_I8254; #if defined(I586_CPU) || defined(I686_CPU) - if (tsc_freq != 0 && !tsc_is_broken && mp_ncpus == 1) + if (tsc_freq != 0 && mp_ncpus == 1) cputime_clock = CPUTIME_CLOCK_TSC; #endif } Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/pc98/pc98/machdep.c Thu Mar 10 20:02:58 2011 (r219461) @@ -1103,7 +1103,7 @@ cpu_est_clockrate(int cpu_id, uint64_t * #endif tsc2 -= tsc1; - if (tsc_freq != 0 && !tsc_is_broken) { + if (tsc_freq != 0) { *rate = tsc2 * 1000; return (0); } Modified: head/sys/x86/isa/clock.c ============================================================================== --- head/sys/x86/isa/clock.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/x86/isa/clock.c Thu Mar 10 20:02:58 2011 (r219461) @@ -261,7 +261,7 @@ DELAY(int n) static int state = 0; #endif - if (tsc_freq != 0 && !tsc_is_broken) { + if (tsc_freq != 0) { uint64_t start, end, now; sched_pin(); Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Thu Mar 10 19:50:12 2011 (r219460) +++ head/sys/x86/x86/tsc.c Thu Mar 10 20:02:58 2011 (r219461) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include "cpufreq_if.h" uint64_t tsc_freq; -int tsc_is_broken; int tsc_is_invariant; int tsc_present; static eventhandler_tag tsc_levels_tag, tsc_pre_tag, tsc_post_tag; @@ -181,7 +180,7 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = -100; #endif - if (tsc_freq != 0 && !tsc_is_broken) { + if (tsc_freq != 0) { tsc_timecounter.tc_frequency = tsc_freq; tc_init(&tsc_timecounter); }