aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/io.h
diff options
context:
space:
mode:
authorHitoshi Mitake <h.mitake@gmail.com>2008-11-30 03:16:04 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-30 03:38:16 -0500
commit2c5643b1c5c7fbb13f340d4c58944d9642f41796 (patch)
treeeebc120df983af518438675cf5c229c6f58c8c3b /arch/x86/include/asm/io.h
parented313489badef16d700f5a3be50e8fd8f8294bc8 (diff)
x86: provide readq()/writeq() on 32-bit too
Impact: add new API for drivers Add implementation of readq/writeq to x86_32, and add config value to the x86 architecture to determine existence of readq/writeq. Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/io.h')
-rw-r--r--arch/x86/include/asm/io.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index ac2abc88cd95..25946449df4f 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -4,6 +4,7 @@
4#define ARCH_HAS_IOREMAP_WC 4#define ARCH_HAS_IOREMAP_WC
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <asm-generic/int-ll64.h>
7 8
8#define build_mmio_read(name, size, type, reg, barrier) \ 9#define build_mmio_read(name, size, type, reg, barrier) \
9static inline type name(const volatile void __iomem *addr) \ 10static inline type name(const volatile void __iomem *addr) \
@@ -57,6 +58,29 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
57/* Let people know we have them */ 58/* Let people know we have them */
58#define readq readq 59#define readq readq
59#define writeq writeq 60#define writeq writeq
61
62#else /* CONFIG_X86_32 from here */
63
64static inline __u64 readq(const volatile void __iomem *addr)
65{
66 const volatile u32 __iomem *p = addr;
67 u32 l, h;
68
69 l = readl(p);
70 h = readl(p + 1);
71
72 return l + ((u64)h << 32);
73}
74
75static inline void writeq(__u64 val, volatile void __iomem *addr)
76{
77 writel(val, addr);
78 writel(val >> 32, addr+4);
79}
80
81#define readq readq
82#define writeq writeq
83
60#endif 84#endif
61 85
62extern int iommu_bio_merge; 86extern int iommu_bio_merge;