From: john stultz <johnstul@us.ibm.com>

On Wed, 2004-01-21 at 23:19, Andrew Morton wrote:
> I seem to have found a config with which my P4 test box is saying to me
> "IO_APIC + timer doesn't work!  pester mingo@redhat.com".
> 
> 
> Disabling the ACPI PM timer in config fixes it up.  I suspect the sanity
> check in there is just saying the wrong thing when we're using timer_pm?

Andrew, 
	I'd be interested if this patch (acpi-pm-timer-fix_B0) works for you.
It uses the pmtmr for the delay_pmtmr function, loosing granularity for
accuracy. 

thanks
-john



---

 25-akpm/arch/i386/kernel/timers/timer_pm.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff -puN arch/i386/kernel/timers/timer_pm.c~use-pmtmr-for-delay_pmtmr arch/i386/kernel/timers/timer_pm.c
--- 25/arch/i386/kernel/timers/timer_pm.c~use-pmtmr-for-delay_pmtmr	Thu Jan 22 15:26:33 2004
+++ 25-akpm/arch/i386/kernel/timers/timer_pm.c	Thu Jan 22 15:26:33 2004
@@ -168,20 +168,23 @@ static unsigned long long monotonic_cloc
 	return ret;
 }
 
-/*
- * copied from delay_pit
- */
-static void delay_pmtmr(unsigned long loops)
+static void delay_pmtmr(unsigned long total_loops)
 {
-	int d0;
-	__asm__ __volatile__(
-		"\tjmp 1f\n"
-		".align 16\n"
-		"1:\tjmp 2f\n"
-		".align 16\n"
-		"2:\tdecl %0\n\tjns 2b"
-		:"=&a" (d0)
-		:"0" (loops));
+	u32 then, now;
+	unsigned long loops;
+
+	do{
+		if (total_loops > ACPI_PM_MASK)
+			loops = ACPI_PM_MASK;
+		else
+			loops =  total_loops;
+		total_loops -= loops;
+
+		then = read_pmtmr();
+		do{
+			now = read_pmtmr();
+		} while (((now - then)&ACPI_PM_MASK) < loops);
+	} while (total_loops);
 }
 
 

_