diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2002-10-17 13:55:39 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2002-10-17 13:55:39 +0000 |
commit | 787db7a9c10ea949e24c3ed4176ab99546205e04 (patch) | |
tree | fe2abf85f0df3482960333875ce1ff5ff3473e0f /sys/isa | |
parent | 64dd2ee656bb0005524d781c28e4c227d6bc5a22 (diff) | |
download | FreeBSD-src-787db7a9c10ea949e24c3ed4176ab99546205e04.zip FreeBSD-src-787db7a9c10ea949e24c3ed4176ab99546205e04.tar.gz |
1. Fix a comment. Locking _is_ needed (but not done).
2. Update a comment. We now restore much more than RTC updates and
interrupts.
3. Order change. Stop interrupts by writing to RTC_STATUSB,
restore rate bits for the interrupts by writing to RTC_STATUSA,
then enable interrupts again.
This seems to be done perfectly backwards in startrtclock().
Otherwise, the idea for this change was obtained from
startrtclock().
4. Don't stop the clock (RTCB_HALT). We only program some control bits
and don't want to stop the clock.
5. (Not really related.) Add caveats to the comment about timer_restore().
The update is non-atomic since locking is not done.
On locking:
6. rtcin() and writertc() are locked() adequately by splhigh() in RELENG_4,
but this locking is null in -current.
7. Doing things in the correct order in (3) combined with (6) is probably
enough locking for rtcrestore() in RELENG_4. In -current, the
writertc()'s race with rtcintr() unless the BIOS disables RTC interrupts.
Submitted by: bde (including commit message)
MFC after: 1 week
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/atrtc.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index ff37d5d..93d486c 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -692,14 +692,6 @@ set_timer_freq(u_int freq, int intr_freq) mtx_unlock_spin(&clock_lock); } -/* - * i8254_restore is called from apm_default_resume() to reload - * the countdown register. - * this should not be necessary but there are broken laptops that - * do not restore the countdown register on resume. - * when it happnes, it messes up the hardclock interval and system clock, - * which leads to the infamous "calcru: negative time" problem. - */ static void i8254_restore(void) { @@ -715,15 +707,19 @@ static void rtc_restore(void) { - /* Reenable RTC updates and interrupts. */ - /* XXX locking is needed for RTC access? */ + /* Restore all of the RTC's "status" (actually, control) registers. */ + /* XXX locking is needed for RTC access. */ + writertc(RTC_STATUSB, RTCSB_24HR); writertc(RTC_STATUSA, rtc_statusa); - writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); writertc(RTC_STATUSB, rtc_statusb); } /* - * Restore all the timers atomically. + * Restore all the timers non-atomically (XXX: should be atomically). + * + * This function is called from pmtimer_resume() to restore all the timers. + * This should not be necessary, but there are broken laptops that do not + * restore all the timers on resume. */ void timer_restore(void) |