Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 1999 16:49:03 +0900
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        steveo@iol.ie
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: FreeBSD on a Compaq 1690
Message-ID:  <199910240749.QAA03558@tasogare.imasy.or.jp>
In-Reply-To: Your message of "Wed, 20 Oct 1999 09:37:03 %2B0100 (IST)" <XFMail.991020093703.steveo@iol.ie>
References:  <XFMail.991020093703.steveo@iol.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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