summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHitoshi Mitake2008-11-30 09:16:04 +0100
committerIngo Molnar2008-11-30 09:38:16 +0100
commit2c5643b1c5c7fbb13f340d4c58944d9642f41796 (patch)
treeeebc120df983af518438675cf5c229c6f58c8c3b
parentMerge master.kernel.org:/home/rmk/linux-2.6-arm (diff)
downloadkernel-qcow2-linux-2c5643b1c5c7fbb13f340d4c58944d9642f41796.tar.gz
kernel-qcow2-linux-2c5643b1c5c7fbb13f340d4c58944d9642f41796.tar.xz
kernel-qcow2-linux-2c5643b1c5c7fbb13f340d4c58944d9642f41796.zip
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>
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/include/asm/io.h24
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac22bb7719f7..a7d50f5d118c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -19,6 +19,8 @@ config X86_64
config X86
def_bool y
select HAVE_AOUT if X86_32
+ select HAVE_READQ
+ select HAVE_WRITEQ
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_IDE
select HAVE_OPROFILE
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 @@
#define ARCH_HAS_IOREMAP_WC
#include <linux/compiler.h>
+#include <asm-generic/int-ll64.h>
#define build_mmio_read(name, size, type, reg, barrier) \
static inline type name(const volatile void __iomem *addr) \
@@ -57,6 +58,29 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
/* Let people know we have them */
#define readq readq
#define writeq writeq
+
+#else /* CONFIG_X86_32 from here */
+
+static inline __u64 readq(const volatile void __iomem *addr)
+{
+ const volatile u32 __iomem *p = addr;
+ u32 l, h;
+
+ l = readl(p);
+ h = readl(p + 1);
+
+ return l + ((u64)h << 32);
+}
+
+static inline void writeq(__u64 val, volatile void __iomem *addr)
+{
+ writel(val, addr);
+ writel(val >> 32, addr+4);
+}
+
+#define readq readq
+#define writeq writeq
+
#endif
extern int iommu_bio_merge;