1 #ifndef _ASM_X86_IO_64_H
2 #define _ASM_X86_IO_64_H
6 * This file contains the definitions for the x86 IO instructions
7 * inb/inw/inl/outb/outw/outl and the "string versions" of the same
8 * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
9 * versions of the single-IO instructions (inb_p/inw_p/..).
11 * This file is not meant to be obfuscating: it's just complicated
12 * to (a) handle it all in a way that makes gcc able to optimize it
13 * as well as possible and (b) trying to avoid writing the same thing
14 * over and over again with slight variations and possibly making a
19 * Thanks to James van Artsdalen for a better timing-fix than
20 * the two short jumps: using outb's to a nonexistent port seems
21 * to guarantee better timings even on fast machines.
23 * On the other hand, I'd like to be sure of a non-existent port:
24 * I feel a bit unsafe about using 0x80 (should be safe, though)
30 * Bit simplified and optimized by Jan Hubicka
31 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
33 * isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
34 * isa_read[wl] and isa_write[wl] fixed
35 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
40 #include <asm-generic/iomap.h>
42 #include <linux/vmalloc.h>
45 * Convert a virtual cached pointer to an uncached pointer
47 #define xlate_dev_kmem_ptr(p) p
49 void memset_io(volatile void __iomem *a, int b, size_t c);
51 void __memcpy_fromio(void *, unsigned long, unsigned);
52 static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
55 __memcpy_fromio(to, (unsigned long)from, len);
58 void __memcpy_toio(unsigned long, const void *, unsigned);
59 static inline void memcpy_toio(volatile void __iomem *to, const void *from,
62 __memcpy_toio((unsigned long)to, from, len);
66 * ISA space is 'always mapped' on a typical x86 system, no need to
67 * explicitly ioremap() it. The fact that the ISA IO space is mapped
68 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
69 * are physical addresses. The following constant pointer can be
70 * used as the IO-area pointer (it can be iounmapped as well, so the
71 * analogy with PCI is quite large):
73 #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
78 * This needed for two cases
79 * 1. Out of order aware processors
80 * 2. Accidentally out of order processors (PPro errata #51)
82 #define flush_write_buffers() do { } while (0)
84 #endif /* __KERNEL__ */
86 extern void native_io_delay(void);
88 extern int io_delay_type;
89 extern void io_delay_init(void);
91 #if defined(CONFIG_PARAVIRT)
92 #include <asm/paravirt.h>
95 static inline void slow_down_io(void)
107 #define BUILDIO(bwl, bw, type) \
108 static inline void out##bwl(unsigned type value, int port) \
110 asm volatile("out" #bwl " %" #bw "0, %w1" \
111 : : "a"(value), "Nd"(port)); \
114 static inline unsigned type in##bwl(int port) \
116 unsigned type value; \
117 asm volatile("in" #bwl " %w1, %" #bw "0" \
118 : "=a"(value) : "Nd"(port)); \
122 static inline void out##bwl##_p(unsigned type value, int port) \
124 out##bwl(value, port); \
128 static inline unsigned type in##bwl##_p(int port) \
130 unsigned type value = in##bwl(port); \
135 static inline void outs##bwl(int port, const void *addr, unsigned long count) \
137 asm volatile("rep; outs" #bwl \
138 : "+S"(addr), "+c"(count) : "d"(port)); \
141 static inline void ins##bwl(int port, void *addr, unsigned long count) \
143 asm volatile("rep; ins" #bwl \
144 : "+D"(addr), "+c"(count) : "d"(port)); \
151 #endif /* _ASM_X86_IO_64_H */