Author: jkim Date: Thu Jul 14 21:00:26 2011 New Revision: 224042 URL: http://svn.freebsd.org/changeset/base/224042
Log: If TSC stops ticking in C3, disable deep sleep when the user forcefully select TSC as timecounter hardware. Tested by: Fabian Keil (freebsd-listen at fabiankeil dot de) Modified: head/sys/kern/kern_tc.c head/sys/sys/timetc.h head/sys/x86/x86/tsc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Thu Jul 14 20:20:33 2011 (r224041) +++ head/sys/kern/kern_tc.c Thu Jul 14 21:00:26 2011 (r224042) @@ -492,6 +492,12 @@ tc_windup(void) /* Now is a good time to change timecounters. */ if (th->th_counter != timecounter) { +#ifndef __arm__ + if ((timecounter->tc_flags & TC_FLAGS_C3STOP) != 0) + cpu_disable_deep_sleep++; + if ((th->th_counter->tc_flags & TC_FLAGS_C3STOP) != 0) + cpu_disable_deep_sleep--; +#endif th->th_counter = timecounter; th->th_offset_count = ncount; tc_min_ticktock_freq = max(1, timecounter->tc_frequency / Modified: head/sys/sys/timetc.h ============================================================================== --- head/sys/sys/timetc.h Thu Jul 14 20:20:33 2011 (r224041) +++ head/sys/sys/timetc.h Thu Jul 14 21:00:26 2011 (r224042) @@ -57,6 +57,8 @@ struct timecounter { * another timecounter higher means better. Negative * means "only use at explicit request". */ + u_int tc_flags; +#define TC_FLAGS_C3STOP 1 /* Timer dies in C3. */ void *tc_priv; /* Pointer to the timecounter's private parts. */ Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Thu Jul 14 20:20:33 2011 (r224041) +++ head/sys/x86/x86/tsc.c Thu Jul 14 21:00:26 2011 (r224042) @@ -452,6 +452,7 @@ init_TSC_tc(void) if (cpu_can_deep_sleep && cpu_vendor_id == CPU_VENDOR_INTEL && (amd_pminfo & AMDPM_TSC_INVARIANT) == 0) { tsc_timecounter.tc_quality = -1000; + tsc_timecounter.tc_flags |= TC_FLAGS_C3STOP; if (bootverbose) printf("TSC timecounter disabled: C3 enabled.\n"); goto init; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"