Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2001 02:22:40 +0900
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        arch@FreeBSD.ORG
Subject:   CFR: Reenabling RTC interrupts after wakeup
Message-ID:  <20010823022240W.iwasaki@jp.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi, I've noticed that RTC interrupts never be generated on some
machines after sleep/wakeup by ACPI.  As a result, statclock() stops
and system statistics monitoring tools (such as systat, vmstat...)
may have problems.

I think that this problem is not only with ACPI, but also with APM
because I saw the same kind of reports before (in mobile@ ?).

Here the fix for this, please review it.  I'll commit this comming
weekend if no objections.

Thanks

Index: include/clock.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/clock.h,v
retrieving revision 1.39
diff -u -r1.39 clock.h
--- include/clock.h	2000/10/15 09:51:48	1.39
+++ include/clock.h	2001/08/21 14:44:29
@@ -44,6 +44,7 @@
 #endif
 int	sysbeep __P((int pitch, int period));
 void	i8254_restore __P((void));
+void	rtc_restore __P((void));
 
 #endif /* _KERNEL */
 
Index: isa/clock.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v
retrieving revision 1.174
diff -u -r1.174 clock.c
--- isa/clock.c	2001/05/15 23:22:21	1.174
+++ isa/clock.c	2001/08/21 14:43:32
@@ -716,6 +716,17 @@
 	mtx_unlock_spin(&clock_lock);
 }
 
+void
+rtc_restore(void)
+{
+
+	mtx_lock_spin(&clock_lock);
+	/* Reenable RTC updates and interrupts. */
+	writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
+	writertc(RTC_STATUSB, rtc_statusb);
+	mtx_unlock_spin(&clock_lock);
+}
+
 /*
  * Initialize 8254 timer 0 early so that it can be used in DELAY().
  * XXX initialization of other timers is unintentionally left blank.
Index: isa/pmtimer.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/pmtimer.c,v
retrieving revision 1.1
diff -u -r1.1 pmtimer.c
--- isa/pmtimer.c	2000/09/14 22:34:57	1.1
+++ isa/pmtimer.c	2001/08/21 15:04:04
@@ -84,6 +84,7 @@
 	/* modified for adjkerntz */
 	pl = splsoftclock();
 	i8254_restore();		/* restore timer_freq and hz */
+	rtc_restore();			/* reenable RTC interrupts */
 	inittodr(0);			/* adjust time to RTC */
 	microtime(&resume_time);
 	getmicrotime(&tmp_time);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010823022240W.iwasaki>