diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/io_32.h | 8 | ||||
-rw-r--r-- | include/asm-x86/io_64.h | 33 |
2 files changed, 28 insertions, 13 deletions
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h index fe881cd1e6f4..a8d25c38b91c 100644 --- a/include/asm-x86/io_32.h +++ b/include/asm-x86/io_32.h | |||
@@ -250,10 +250,14 @@ static inline void flush_write_buffers(void) | |||
250 | 250 | ||
251 | #endif /* __KERNEL__ */ | 251 | #endif /* __KERNEL__ */ |
252 | 252 | ||
253 | static inline void native_io_delay(void) | 253 | #ifndef CONFIG_UDELAY_IO_DELAY |
254 | extern void io_delay_init(void); | ||
255 | #else | ||
256 | static inline void io_delay_init(void) | ||
254 | { | 257 | { |
255 | asm volatile("outb %%al,$0x80" : : : "memory"); | ||
256 | } | 258 | } |
259 | #endif | ||
260 | extern void native_io_delay(void); | ||
257 | 261 | ||
258 | #if defined(CONFIG_PARAVIRT) | 262 | #if defined(CONFIG_PARAVIRT) |
259 | #include <asm/paravirt.h> | 263 | #include <asm/paravirt.h> |
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 |
39 | extern void io_delay_init(void); | ||
40 | #else | ||
41 | static inline void io_delay_init(void) | ||
42 | { | ||
43 | } | ||
44 | #endif | ||
45 | extern void native_io_delay(void); | ||
39 | 46 | ||
47 | static 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 @@ | |||
50 | static inline void out##s(unsigned x value, unsigned short port) { | 61 | static 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) \ |
60 | static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; | 71 | static 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) \ |
70 | static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ | 81 | static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ |