aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/io_64.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/io_64.h')
-rw-r--r--include/asm-x86/io_64.h57
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" 38extern void native_io_delay(void);
39 39
40#ifdef REALLY_SLOW_IO 40extern int io_delay_type;
41#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO 41extern 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
47static 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) \
60static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; 78static 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) \
70static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ 93static 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
130extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags);
131
132static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
133{
134 return __ioremap(offset, size, 0);
135}
136
137extern void *early_ioremap(unsigned long addr, unsigned long size); 153extern void *early_ioremap(unsigned long addr, unsigned long size);
138extern void early_iounmap(void *addr, unsigned long size); 154extern 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 */
145extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 161extern void __iomem *ioremap_nocache(unsigned long offset, unsigned long size);
162extern void __iomem *ioremap_cache(unsigned long offset, unsigned long size);
163
164/*
165 * The default ioremap() behavior is non-cached:
166 */
167static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
168{
169 return ioremap_nocache(offset, size);
170}
171
146extern void iounmap(volatile void __iomem *addr); 172extern void iounmap(volatile void __iomem *addr);
173
147extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); 174extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
148 175
149/* 176/*