Re: [PATCH] x86: use explicit timing delay for pit accesses in kerneland pcspkr driver

From: Rene Herman
Date: Mon Feb 18 2008 - 15:37:39 EST


On 18-02-08 19:58, David P. Reed wrote:

--- linux-2.6.orig/include/asm-x86/i8253.h
+++ linux-2.6/include/asm-x86/i8253.h
@@ -12,7 +12,25 @@ extern struct clock_event_device *global
extern void setup_pit_timer(void);
-#define inb_pit inb_p
-#define outb_pit outb_p
+/* accesses to PIT registers need careful delays on some platforms. Define
+ them here in a common place */
+static inline unsigned char inb_pit(unsigned int port)
+{
+ /* delay for some accesses to PIT on motherboard or in chipset must be
+ at least one microsecond, but be safe here. */
+ unsigned char value = inb(port);
+ udelay(2);
+ return value;
+}

With the remark that (at least) the PIT is accessed at a time that microseconds and hence udelay are still a total fiction, this looks obvious otherwise.

Now with respect to the original pre port 80 "jmp $+2" I/O delay (which the Pentium obsoleted) I suppose it'll probably be okay even without fixing that specifically but do note such -- it's a vital part of the problem.

Rene.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/