From owner-freebsd-mobile Sun Oct 24 0:49:22 1999 Delivered-To: freebsd-mobile@freebsd.org Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by hub.freebsd.org (Postfix) with ESMTP id 4FF7D15091 for ; Sun, 24 Oct 1999 00:49:15 -0700 (PDT) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (isdn41.imasy.or.jp [202.227.24.233]) by tasogare.imasy.or.jp (8.9.3+3.2W/3.7W-tasogare/smtpfeed 1.01) with ESMTP id QAA03558; Sun, 24 Oct 1999 16:49:04 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Message-Id: <199910240749.QAA03558@tasogare.imasy.or.jp> To: steveo@iol.ie Cc: freebsd-mobile@freebsd.org Subject: Re: FreeBSD on a Compaq 1690 In-Reply-To: Your message of "Wed, 20 Oct 1999 09:37:03 +0100 (IST)" References: X-Mailer: Mew version 1.93 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 24 Oct 1999 16:49:03 +0900 From: Mitsuru IWASAKI X-Dispatcher: imput version 980905(IM100) Lines: 80 Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, > Suspend and resume slows the system down hugely (apmconf -t doesn't help), > doing it twice makes things worse, I haven't tried more. What should I > try in order to get a handle on this. > > All this with 3.3-STABLE about two weeks old. i8254 on your laptop seemds having problem after resuming. # my SHARP laptop too. Please try the attached patch. Index: sys/i386/apm/apm.c =================================================================== RCS file: /home/ncvs/src/sys/i386/apm/apm.c,v retrieving revision 1.77.2.13 diff -u -r1.77.2.13 apm.c --- apm.c 1999/10/13 22:06:46 1.77.2.13 +++ apm.c 1999/10/23 21:03:17 @@ -450,6 +450,7 @@ /* modified for adjkerntz */ pl = splsoftclock(); + i8254_restore(); /* restore timer_freq and hz */ inittodr(0); /* adjust time to RTC */ microtime(&resume_time); getmicrotime(&tmp_time); Index: sys/i386/include/clock.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/clock.h,v retrieving revision 1.34.2.2 diff -u -r1.34.2.2 clock.h --- clock.h 1999/08/29 16:06:23 1.34.2.2 +++ clock.h 1999/10/23 21:02:24 @@ -44,6 +44,7 @@ int release_timer1 __P((void)); #endif int sysbeep __P((int pitch, int period)); +void i8254_restore __P((void)); #endif /* KERNEL */ Index: sys/i386/isa/clock.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v retrieving revision 1.129.2.4 diff -u -r1.129.2.4 clock.c --- clock.c 1999/08/29 16:07:14 1.129.2.4 +++ clock.c 1999/10/23 21:20:18 @@ -703,6 +703,28 @@ } /* + * 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. + */ +void +i8254_restore(void) +{ + u_long ef; + + ef = read_eflags(); + disable_intr(); + outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); + outb(TIMER_CNTR0, timer0_max_count & 0xff); + outb(TIMER_CNTR0, timer0_max_count >> 8); + CLOCK_UNLOCK(); + write_eflags(ef); +} + +/* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message