aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/io_64.h
diff options
context:
space:
mode:
authorRene Herman <rene.herman@gmail.com>2008-01-30 07:30:05 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:05 -0500
commitb02aae9cf52956dfe1bec73f77f81a3d05d3902b (patch)
treece715a107c853960cc9541377aeae0ff31ac25f7 /include/asm-x86/io_64.h
parent4c6b8b4d62fb4cb843c32db71e0a8301039908f3 (diff)
x86: provide a DMI based port 0x80 I/O delay override.
x86: provide a DMI based port 0x80 I/O delay override. Certain (HP) laptops experience trouble from our port 0x80 I/O delay writes. This patch provides for a DMI based switch to the "alternate diagnostic port" 0xed (as used by some BIOSes as well) for these. David P. Reed confirmed that port 0xed works for him and provides a proper delay. The symptoms of _not_ working are a hanging machine, with "hwclock" use being a direct trigger. Earlier versions of this attempted to simply use udelay(2), with the 2 being a value tested to be a nicely conservative upper-bound with help from many on the linux-kernel mailinglist but that approach has two problems. First, pre-loops_per_jiffy calibration (which is post PIT init while some implementations of the PIT are actually one of the historically problematic devices that need the delay) udelay() isn't particularly well-defined. We could initialise loops_per_jiffy conservatively (and based on CPU family so as to not unduly delay old machines) which would sort of work, but... Second, delaying isn't the only effect that a write to port 0x80 has. It's also a PCI posting barrier which some devices may be explicitly or implicitly relying on. Alan Cox did a survey and found evidence that additionally some drivers may be racy on SMP without the bus locking outb. Switching to an inb() makes the timing too unpredictable and as such, this DMI based switch should be the safest approach for now. Any more invasive changes should get more rigid testing first. It's moreover only very few machines with the problem and a DMI based hack seems to fit that situation. This also introduces a command-line parameter "io_delay" to override the DMI based choice again: io_delay=<standard|alternate> where "standard" means using the standard port 0x80 and "alternate" port 0xed. This retains the udelay method as a config (CONFIG_UDELAY_IO_DELAY) and command-line ("io_delay=udelay") choice for testing purposes as well. This does not change the io_delay() in the boot code which is using the same port 0x80 I/O delay but those do not appear to be a problem as David P. Reed reported the problem was already gone after using the udelay version. He moreover reported that booting with "acpi=off" also fixed things and seeing as how ACPI isn't touched until after this DMI based I/O port switch I believe it's safe to leave the ones in the boot code be. The DMI strings from David's HP Pavilion dv9000z are in there already and we need to get/verify the DMI info from other machines with the problem, notably the HP Pavilion dv6000z. This patch is partly based on earlier patches from Pavel Machek and David P. Reed. Signed-off-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/io_64.h')
-rw-r--r--include/asm-x86/io_64.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/include/asm-x86/io_64.h b/include/asm-x86/io_64.h
index a037b0794332..5bebaf961692 100644
--- a/include/asm-x86/io_64.h
+++ b/include/asm-x86/io_64.h
@@ -35,13 +35,24 @@
35 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br> 35 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
36 */ 36 */
37 37
38#define __SLOW_DOWN_IO "\noutb %%al,$0x80" 38#ifndef CONFIG_UDELAY_IO_DELAY
39extern void io_delay_init(void);
40#else
41static inline void io_delay_init(void)
42{
43}
44#endif
45extern void native_io_delay(void);
39 46
47static inline void slow_down_io(void)
48{
49 native_io_delay();
40#ifdef REALLY_SLOW_IO 50#ifdef REALLY_SLOW_IO
41#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO 51 native_io_delay();
42#else 52 native_io_delay();
43#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO 53 native_io_delay();
44#endif 54#endif
55}
45 56
46/* 57/*
47 * Talk about misusing macros.. 58 * Talk about misusing macros..
@@ -50,21 +61,21 @@
50static inline void out##s(unsigned x value, unsigned short port) { 61static inline void out##s(unsigned x value, unsigned short port) {
51 62
52#define __OUT2(s,s1,s2) \ 63#define __OUT2(s,s1,s2) \
53__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" 64__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" : : "a" (value), "Nd" (port))
54 65
55#define __OUT(s,s1,x) \ 66#define __OUT(s,s1,x) \
56__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ 67__OUT1(s,x) __OUT2(s,s1,"w"); } \
57__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ 68__OUT1(s##_p,x) __OUT2(s,s1,"w"); slow_down_io(); }
58 69
59#define __IN1(s) \ 70#define __IN1(s) \
60static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; 71static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
61 72
62#define __IN2(s,s1,s2) \ 73#define __IN2(s,s1,s2) \
63__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" 74__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" : "=a" (_v) : "Nd" (port))
64 75
65#define __IN(s,s1,i...) \ 76#define __IN(s,s1) \
66__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ 77__IN1(s) __IN2(s,s1,"w"); return _v; } \
67__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ 78__IN1(s##_p) __IN2(s,s1,"w"); slow_down_io(); return _v; }
68 79
69#define __INS(s) \ 80#define __INS(s) \
70static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ 81static inline void ins##s(unsigned short port, void * addr, unsigned long count) \