Messages in this thread Patch in this message | | | From | "Olsen, Jim" <> | Subject | [PATCH] udelay() for Alpha 2.2 | Date | Tue, 21 Sep 1999 21:16:53 -0400 |
| |
Below is a simple patch for the udelay() problem on EV6 alpha processors. For those of you who prefer one line fixes, the following will work equally well:
- __asm__ __volatile__(".align 3\n" + __asm__ __volatile__(".align 4\n\tnop\n\tnop\n"
Alpha delay loops are currently quadword aligned. If the delay loop in ncrgetfreq() falls on an even quadword, that loop will run at half speed on EV6 processors. This is a function of the other two instructions (two ldq's in this case) that share the same octaword as the delay loop (subq bge). By forcing at least one "nop" into the octaword we can guarantee consistent (fast) performance on the 21264 microprocessor.
In most cases if udelay(1) causes a 2 microsecond delay, the only consequence is the loss of a few cycles. However, the ncr53cxx and sym53cxx drivers use udelay(1000) to calculate the NCR clock frequency. When a time of 200 milliseconds is mistaken for 100, a 40MHz clock is mistaken for 80MHz. When the controller fails to operate at that speed, the system fails to boot.
I believe this problem is serious enough to warrant a fix in 2.2. I will reissue the udelay() that uses the processor cycle counter as a patch to 2.3
Jim
--- linux-2.2.12/include/asm-alpha/delay.h Tue Dec 29 16:56:15 1998 +++ patch-2.2.12/include/asm-alpha/delay.h Mon Sep 20 14:47:56 1999 @@ -12,9 +12,10 @@ extern __inline__ void __delay(unsigned long loops) { - __asm__ __volatile__(".align 3\n" + __asm__ __volatile__(".align 4\n" "1:\tsubq %0,1,%0\n\t" - "bge %0,1b": "=r" (loops) : "0" (loops)); + "bge %0,1b\n\t" + "nop": "=r" (loops) : "0" (loops)); }
/*
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |