V4L/DVB (9003): S2API: Remove the DTV_SET_ and DTV_GET_ prefixes
[linux-2.6] / 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 extern int iommu_bio_merge;
77
78 #ifdef CONFIG_X86_32
79 # include "io_32.h"
80 #else
81 # include "io_64.h"
82 #endif
83
84 extern void *xlate_dev_mem_ptr(unsigned long phys);
85 extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
86
87 extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
88                                 unsigned long prot_val);
89 extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);
90
91 /*
92  * early_ioremap() and early_iounmap() are for temporary early boot-time
93  * mappings, before the real ioremap() is functional.
94  * A boot-time mapping is currently limited to at most 16 pages.
95  */
96 extern void early_ioremap_init(void);
97 extern void early_ioremap_clear(void);
98 extern void early_ioremap_reset(void);
99 extern void *early_ioremap(unsigned long offset, unsigned long size);
100 extern void early_iounmap(void *addr, unsigned long size);
101 extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
102
103
104 #endif /* ASM_X86__IO_H */