diff options
Diffstat (limited to 'include/asm-x86/io_64.h')
-rw-r--r-- | include/asm-x86/io_64.h | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/include/asm-x86/io_64.h b/include/asm-x86/io_64.h index a037b0794332..f64a59cc396d 100644 --- a/include/asm-x86/io_64.h +++ b/include/asm-x86/io_64.h | |||
@@ -35,12 +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 | extern void native_io_delay(void); |
39 | 39 | ||
40 | #ifdef REALLY_SLOW_IO | 40 | extern int io_delay_type; |
41 | #define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO | 41 | extern void io_delay_init(void); |
42 | |||
43 | #if defined(CONFIG_PARAVIRT) | ||
44 | #include <asm/paravirt.h> | ||
42 | #else | 45 | #else |
43 | #define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO | 46 | |
47 | static inline void slow_down_io(void) | ||
48 | { | ||
49 | native_io_delay(); | ||
50 | #ifdef REALLY_SLOW_IO | ||
51 | native_io_delay(); | ||
52 | native_io_delay(); | ||
53 | native_io_delay(); | ||
54 | #endif | ||
55 | } | ||
44 | #endif | 56 | #endif |
45 | 57 | ||
46 | /* | 58 | /* |
@@ -52,9 +64,15 @@ static inline void out##s(unsigned x value, unsigned short port) { | |||
52 | #define __OUT2(s,s1,s2) \ | 64 | #define __OUT2(s,s1,s2) \ |
53 | __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" | 65 | __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" |
54 | 66 | ||
67 | #ifndef REALLY_SLOW_IO | ||
68 | #define REALLY_SLOW_IO | ||
69 | #define UNSET_REALLY_SLOW_IO | ||
70 | #endif | ||
71 | |||
55 | #define __OUT(s,s1,x) \ | 72 | #define __OUT(s,s1,x) \ |
56 | __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ | 73 | __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ |
57 | __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ | 74 | __OUT1(s##_p, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port)); \ |
75 | slow_down_io(); } | ||
58 | 76 | ||
59 | #define __IN1(s) \ | 77 | #define __IN1(s) \ |
60 | static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; | 78 | static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; |
@@ -63,8 +81,13 @@ static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; | |||
63 | __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" | 81 | __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" |
64 | 82 | ||
65 | #define __IN(s,s1,i...) \ | 83 | #define __IN(s,s1,i...) \ |
66 | __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ | 84 | __IN1(s) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); return _v; } \ |
67 | __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ | 85 | __IN1(s##_p) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); \ |
86 | slow_down_io(); return _v; } | ||
87 | |||
88 | #ifdef UNSET_REALLY_SLOW_IO | ||
89 | #undef REALLY_SLOW_IO | ||
90 | #endif | ||
68 | 91 | ||
69 | #define __INS(s) \ | 92 | #define __INS(s) \ |
70 | static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ | 93 | static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ |
@@ -127,13 +150,6 @@ static inline void * phys_to_virt(unsigned long address) | |||
127 | 150 | ||
128 | #include <asm-generic/iomap.h> | 151 | #include <asm-generic/iomap.h> |
129 | 152 | ||
130 | extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags); | ||
131 | |||
132 | static inline void __iomem * ioremap (unsigned long offset, unsigned long size) | ||
133 | { | ||
134 | return __ioremap(offset, size, 0); | ||
135 | } | ||
136 | |||
137 | extern void *early_ioremap(unsigned long addr, unsigned long size); | 153 | extern void *early_ioremap(unsigned long addr, unsigned long size); |
138 | extern void early_iounmap(void *addr, unsigned long size); | 154 | extern void early_iounmap(void *addr, unsigned long size); |
139 | 155 | ||
@@ -142,8 +158,19 @@ extern void early_iounmap(void *addr, unsigned long size); | |||
142 | * it's useful if some control registers are in such an area and write combining | 158 | * it's useful if some control registers are in such an area and write combining |
143 | * or read caching is not desirable: | 159 | * or read caching is not desirable: |
144 | */ | 160 | */ |
145 | extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); | 161 | extern void __iomem *ioremap_nocache(unsigned long offset, unsigned long size); |
162 | extern void __iomem *ioremap_cache(unsigned long offset, unsigned long size); | ||
163 | |||
164 | /* | ||
165 | * The default ioremap() behavior is non-cached: | ||
166 | */ | ||
167 | static inline void __iomem *ioremap(unsigned long offset, unsigned long size) | ||
168 | { | ||
169 | return ioremap_nocache(offset, size); | ||
170 | } | ||
171 | |||
146 | extern void iounmap(volatile void __iomem *addr); | 172 | extern void iounmap(volatile void __iomem *addr); |
173 | |||
147 | extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); | 174 | extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); |
148 | 175 | ||
149 | /* | 176 | /* |