Reenable RTC interrupts after wakeup. Some laptops have a problem
with system statistics monitoring tools (such as systat, vmstat...) because of stopping RTC interrupts generation. Restore all the timers (RTC and i8254) atomically. Reviewed by: bde MFC after: 1 week
This commit is contained in:
parent
38090f05c2
commit
db2077f8e1
@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq)
|
||||
* when it happnes, it messes up the hardclock interval and system clock,
|
||||
* which leads to the infamous "calcru: negative time" problem.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
i8254_restore(void)
|
||||
{
|
||||
|
||||
@ -716,6 +716,27 @@ i8254_restore(void)
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
rtc_restore(void)
|
||||
{
|
||||
|
||||
/* Reenable RTC updates and interrupts. */
|
||||
/* XXX locking is needed for RTC access? */
|
||||
writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
|
||||
writertc(RTC_STATUSB, rtc_statusb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all the timers atomically.
|
||||
*/
|
||||
void
|
||||
timer_restore(void)
|
||||
{
|
||||
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
rtc_restore(); /* reenable RTC interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 8254 timer 0 early so that it can be used in DELAY().
|
||||
* XXX initialization of other timers is unintentionally left blank.
|
||||
|
@ -43,7 +43,7 @@ int acquire_timer1 __P((int mode));
|
||||
int release_timer1 __P((void));
|
||||
#endif
|
||||
int sysbeep __P((int pitch, int period));
|
||||
void i8254_restore __P((void));
|
||||
void timer_restore __P((void));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq)
|
||||
* when it happnes, it messes up the hardclock interval and system clock,
|
||||
* which leads to the infamous "calcru: negative time" problem.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
i8254_restore(void)
|
||||
{
|
||||
|
||||
@ -716,6 +716,27 @@ i8254_restore(void)
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
rtc_restore(void)
|
||||
{
|
||||
|
||||
/* Reenable RTC updates and interrupts. */
|
||||
/* XXX locking is needed for RTC access? */
|
||||
writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
|
||||
writertc(RTC_STATUSB, rtc_statusb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all the timers atomically.
|
||||
*/
|
||||
void
|
||||
timer_restore(void)
|
||||
{
|
||||
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
rtc_restore(); /* reenable RTC interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 8254 timer 0 early so that it can be used in DELAY().
|
||||
* XXX initialization of other timers is unintentionally left blank.
|
||||
|
@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq)
|
||||
* when it happnes, it messes up the hardclock interval and system clock,
|
||||
* which leads to the infamous "calcru: negative time" problem.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
i8254_restore(void)
|
||||
{
|
||||
|
||||
@ -716,6 +716,27 @@ i8254_restore(void)
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
rtc_restore(void)
|
||||
{
|
||||
|
||||
/* Reenable RTC updates and interrupts. */
|
||||
/* XXX locking is needed for RTC access? */
|
||||
writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
|
||||
writertc(RTC_STATUSB, rtc_statusb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all the timers atomically.
|
||||
*/
|
||||
void
|
||||
timer_restore(void)
|
||||
{
|
||||
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
rtc_restore(); /* reenable RTC interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 8254 timer 0 early so that it can be used in DELAY().
|
||||
* XXX initialization of other timers is unintentionally left blank.
|
||||
|
@ -43,7 +43,7 @@ int acquire_timer1 __P((int mode));
|
||||
int release_timer1 __P((void));
|
||||
#endif
|
||||
int sysbeep __P((int pitch, int period));
|
||||
void i8254_restore __P((void));
|
||||
void timer_restore __P((void));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq)
|
||||
* when it happnes, it messes up the hardclock interval and system clock,
|
||||
* which leads to the infamous "calcru: negative time" problem.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
i8254_restore(void)
|
||||
{
|
||||
|
||||
@ -716,6 +716,27 @@ i8254_restore(void)
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
rtc_restore(void)
|
||||
{
|
||||
|
||||
/* Reenable RTC updates and interrupts. */
|
||||
/* XXX locking is needed for RTC access? */
|
||||
writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
|
||||
writertc(RTC_STATUSB, rtc_statusb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all the timers atomically.
|
||||
*/
|
||||
void
|
||||
timer_restore(void)
|
||||
{
|
||||
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
rtc_restore(); /* reenable RTC interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 8254 timer 0 early so that it can be used in DELAY().
|
||||
* XXX initialization of other timers is unintentionally left blank.
|
||||
|
@ -83,7 +83,7 @@ pmtimer_resume(device_t dev)
|
||||
|
||||
/* modified for adjkerntz */
|
||||
pl = splsoftclock();
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
timer_restore(); /* restore the all timers */
|
||||
inittodr(0); /* adjust time to RTC */
|
||||
microtime(&resume_time);
|
||||
getmicrotime(&tmp_time);
|
||||
|
@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq)
|
||||
* when it happnes, it messes up the hardclock interval and system clock,
|
||||
* which leads to the infamous "calcru: negative time" problem.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
i8254_restore(void)
|
||||
{
|
||||
|
||||
@ -716,6 +716,27 @@ i8254_restore(void)
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
rtc_restore(void)
|
||||
{
|
||||
|
||||
/* Reenable RTC updates and interrupts. */
|
||||
/* XXX locking is needed for RTC access? */
|
||||
writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
|
||||
writertc(RTC_STATUSB, rtc_statusb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all the timers atomically.
|
||||
*/
|
||||
void
|
||||
timer_restore(void)
|
||||
{
|
||||
|
||||
i8254_restore(); /* restore timer_freq and hz */
|
||||
rtc_restore(); /* reenable RTC interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 8254 timer 0 early so that it can be used in DELAY().
|
||||
* XXX initialization of other timers is unintentionally left blank.
|
||||
|
Loading…
Reference in New Issue
Block a user