]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-x86/io.h
Merge branch 'x86/core' into x86/xsave
[linux-2.6-omap-h63xx.git] / include / asm-x86 / io.h
1 #ifndef ASM_X86__IO_H
2 #define ASM_X86__IO_H
3
4 #define ARCH_HAS_IOREMAP_WC
5
6 #include <linux/compiler.h>
7
8 /*
9  * early_ioremap() and early_iounmap() are for temporary early boot-time
10  * mappings, before the real ioremap() is functional.
11  * A boot-time mapping is currently limited to at most 16 pages.
12  */
13 #ifndef __ASSEMBLY__
14 extern void early_ioremap_init(void);
15 extern void early_ioremap_clear(void);
16 extern void early_ioremap_reset(void);
17 extern void *early_ioremap(unsigned long offset, unsigned long size);
18 extern void early_iounmap(void *addr, unsigned long size);
19 extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
20 #endif
21
22 #define build_mmio_read(name, size, type, reg, barrier) \
23 static inline type name(const volatile void __iomem *addr) \
24 { type ret; asm volatile("mov" size " %1,%0":"=" reg (ret) \
25 :"m" (*(volatile type __force *)addr) barrier); return ret; }
26
27 #define build_mmio_write(name, size, type, reg, barrier) \
28 static inline void name(type val, volatile void __iomem *addr) \
29 { asm volatile("mov" size " %0,%1": :reg (val), \
30 "m" (*(volatile type __force *)addr) barrier); }
31
32 build_mmio_read(readb, "b", unsigned char, "q", :"memory")
33 build_mmio_read(readw, "w", unsigned short, "r", :"memory")
34 build_mmio_read(readl, "l", unsigned int, "r", :"memory")
35
36 build_mmio_read(__readb, "b", unsigned char, "q", )
37 build_mmio_read(__readw, "w", unsigned short, "r", )
38 build_mmio_read(__readl, "l", unsigned int, "r", )
39
40 build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
41 build_mmio_write(writew, "w", unsigned short, "r", :"memory")
42 build_mmio_write(writel, "l", unsigned int, "r", :"memory")
43
44 build_mmio_write(__writeb, "b", unsigned char, "q", )
45 build_mmio_write(__writew, "w", unsigned short, "r", )
46 build_mmio_write(__writel, "l", unsigned int, "r", )
47
48 #define readb_relaxed(a) __readb(a)
49 #define readw_relaxed(a) __readw(a)
50 #define readl_relaxed(a) __readl(a)
51 #define __raw_readb __readb
52 #define __raw_readw __readw
53 #define __raw_readl __readl
54
55 #define __raw_writeb __writeb
56 #define __raw_writew __writew
57 #define __raw_writel __writel
58
59 #define mmiowb() barrier()
60
61 #ifdef CONFIG_X86_64
62 build_mmio_read(readq, "q", unsigned long, "r", :"memory")
63 build_mmio_read(__readq, "q", unsigned long, "r", )
64 build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
65 build_mmio_write(__writeq, "q", unsigned long, "r", )
66
67 #define readq_relaxed(a) __readq(a)
68 #define __raw_readq __readq
69 #define __raw_writeq writeq
70
71 /* Let people know we have them */
72 #define readq readq
73 #define writeq writeq
74 #endif
75
76 #ifdef CONFIG_X86_32
77 # include "io_32.h"
78 #else
79 # include "io_64.h"
80 #endif
81
82 extern void *xlate_dev_mem_ptr(unsigned long phys);
83 extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
84
85 extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
86                                 unsigned long prot_val);
87 extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);
88
89 /*
90  * early_ioremap() and early_iounmap() are for temporary early boot-time
91  * mappings, before the real ioremap() is functional.
92  * A boot-time mapping is currently limited to at most 16 pages.
93  */
94 extern void early_ioremap_init(void);
95 extern void early_ioremap_clear(void);
96 extern void early_ioremap_reset(void);
97 extern void *early_ioremap(unsigned long offset, unsigned long size);
98 extern void early_iounmap(void *addr, unsigned long size);
99 extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
100
101
102 #endif /* ASM_X86__IO_H */