Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2000 14:53:53 +0200
From:      "Jose M. Alcaide" <jose@we.lc.ehu.es>
To:        Kenneth Wayne Culver <culverk@wam.umd.edu>
Cc:        freebsd-mobile@FreeBSD.ORG
Subject:   Re: dell laptops
Message-ID:  <39BF78E1.3A7D266E@we.lc.ehu.es>
References:  <Pine.GSO.4.21.0009130741180.15681-100000@rac2.wam.umd.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------F123CCA1D337C13D8E1746E9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kenneth Wayne Culver wrote:
> 
> I installed from CDROM, and it still wouldn't work.... (4.1R) That's why I
> cvsupped to stable... My linksys card wouldn't work for the install (it's
> V2 of a supported card, but it barely works even after I edit
> pccard.conf) not to mention the broken statclock.
> 

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).

Cheers,
-- JMA
****** Jose M. Alcaide  //  jose@we.lc.ehu.es  //  jmas@FreeBSD.org ******
** "Beware of Programmers who carry screwdrivers" --  Leonard Brandwein **
--------------F123CCA1D337C13D8E1746E9
Content-Type: text/plain; charset=us-ascii;
 name="statclock.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="statclock.patch"

--- 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;
 

--------------F123CCA1D337C13D8E1746E9--



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?39BF78E1.3A7D266E>