1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

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)
This commit is contained in:
Jung-uk Kim 2011-07-14 21:00:26 +00:00
parent 5dbee633d2
commit 08e1b4f4a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224042
3 changed files with 9 additions and 0 deletions

View File

@ -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 /

View File

@ -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. */

View File

@ -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;