Date: Wed, 13 Sep 2000 08:13:13 -0600 (MDT) From: Nate Williams <nate@yogotech.com> To: "Jose M. Alcaide" <jose@we.lc.ehu.es> Cc: Kenneth Wayne Culver <culverk@wam.umd.edu>, freebsd-mobile@FreeBSD.ORG Subject: Re: dell laptops Message-ID: <200009131413.IAA00612@nomad.yogotech.com> In-Reply-To: <39BF78E1.3A7D266E@we.lc.ehu.es> References: <Pine.GSO.4.21.0009130741180.15681-100000@rac2.wam.umd.edu> <39BF78E1.3A7D266E@we.lc.ehu.es>
next in thread | previous in thread | raw e-mail | index | archive | help
> With respect to the broken statclock, I wrote a set of patches (attached) > which enable the statclock *and* keep suspend/resume working. They work > fine on my Dell Inspiron 3700. These patches apply cleanly to 4.1-RELEASE, > and I think that to 4.1-STABLE also. (Note: set the 0x20 flag in the > apm's config line). Hmmmmm.... I like this, and feel silly for not doing it awhile back. I'm going to test these out on my box which was used to debug the problem originally, to see if they work. Thanks Jose! Nate > > Cheers, > -- JMA > ****** Jose M. Alcaide // jose@we.lc.ehu.es // jmas@FreeBSD.org ****** > ** "Beware of Programmers who carry screwdrivers" -- Leonard Brandwein **--- sys/i386/isa/clock.c.orig Tue Jan 4 23:24:59 2000 > +++ sys/i386/isa/clock.c Thu May 25 23:23:57 2000 > @@ -132,7 +132,6 @@ > int clkintr_pending; > int disable_rtc_set; /* disable resettodr() if != 0 */ > volatile u_int idelayed; > -int statclock_disable; > u_int stat_imask = SWI_CLOCK_MASK; > #ifndef TIMER_FREQ > #define TIMER_FREQ 1193182 > @@ -828,6 +827,27 @@ > } > > /* > + * The following two functions are called from apm.c for stopping and > + * restarting the statclock interrupts from the RTC, if the apm's > + * broken_statclock flag is set (some laptops don't enter suspend mode > + * while the RTC is generating interrupts). > + */ > +void > +statclock_stop(void) > +{ > + /* disable RTC interrupts and clear any pending one */ > + writertc(RTC_STATUSB, RTCSB_24HR); > + rtcin(RTC_INTR); > +} > + > +void > +statclock_restart(void) > +{ > + /* re-enable the RTC interrupts */ > + writertc(RTC_STATUSB, rtc_statusb); > +} > + > +/* > * Initialize the time of day register, based on the time base which is, e.g. > * from a filesystem. > */ > @@ -975,20 +995,9 @@ > struct intrec *clkdesc; > #endif /* APIC_IO */ > > - if (statclock_disable) { > - /* > - * The stat interrupt mask is different without the > - * statistics clock. Also, don't set the interrupt > - * flag which would normally cause the RTC to generate > - * interrupts. > - */ > - stat_imask = HWI_MASK | SWI_MASK; > - rtc_statusb = RTCSB_24HR; > - } else { > - /* Setting stathz to nonzero early helps avoid races. */ > - stathz = RTC_NOPROFRATE; > - profhz = RTC_PROFRATE; > - } > + /* Setting stathz to nonzero early helps avoid races. */ > + stathz = RTC_NOPROFRATE; > + profhz = RTC_PROFRATE; > > /* Finish initializing 8253 timer 0. */ > #ifdef APIC_IO > @@ -1022,10 +1031,8 @@ > /* Initialize RTC. */ > writertc(RTC_STATUSA, rtc_statusa); > writertc(RTC_STATUSB, RTCSB_24HR); > + rtcin(RTC_INTR); /* clear any pending interrupt */ > > - /* Don't bother enabling the statistics clock. */ > - if (statclock_disable) > - return; > diag = rtcin(RTC_DIAG); > if (diag != 0) > printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); > --- sys/i386/include/clock.h.orig Wed Dec 29 05:32:58 1999 > +++ sys/i386/include/clock.h Thu May 25 23:26:45 2000 > @@ -16,7 +16,6 @@ > */ > extern int adjkerntz; > extern int disable_rtc_set; > -extern int statclock_disable; > extern u_int timer_freq; > extern int timer0_max_count; > extern u_int tsc_freq; > @@ -45,6 +44,8 @@ > #endif > int sysbeep __P((int pitch, int period)); > void i8254_restore __P((void)); > +void statclock_stop __P((void)); > +void statclock_restart __P((void)); > > #endif /* _KERNEL */ > > --- sys/i386/apm/apm.c.orig Sun Feb 6 15:57:05 2000 > +++ sys/i386/apm/apm.c Thu May 25 23:39:03 2000 > @@ -101,6 +101,8 @@ > /* bmaj */ -1 > }; > > +static int broken_statclock = 0; > + > static int apm_suspend_delay = 1; > static int apm_standby_delay = 1; > > @@ -404,6 +406,8 @@ > > /* modified for adjkerntz */ > pl = splsoftclock(); > + if (broken_statclock) /* restart statclock if broken */ > + statclock_restart(); > i8254_restore(); /* restore timer_freq and hz */ > inittodr(0); /* adjust time to RTC */ > microtime(&resume_time); > @@ -450,6 +454,8 @@ > inittodr(0); > microtime(&suspend_time); > timevalsub(&diff_time, &suspend_time); > + if (broken_statclock) /* stop statclock if broken */ > + statclock_stop(); > splx(pl); > return 0; > } > @@ -1003,7 +1009,7 @@ > flags = 0; > > if (flags & 0x20) > - statclock_disable = 1; > + broken_statclock = 1; > > sc->initialized = 0; > 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?200009131413.IAA00612>