Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672847

[PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations

From Logan Gunthorpe <logang@deltatee.com>
Newsgroups linux.kernel
Subject [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations
Date 2017-06-22 19:00 +0200
Message-ID <tVdCA-7lD-69@gated-at.bofh.it> (permalink)
References <tVdsS-7hT-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Alpha implements its own io operation and doesn't use the
common library. Thus to make ioread64 and iowrite64 globally
available we need to add implementations for alpha.

For this, we simply use calls that chain two 32-bit operations.
(mostly because I don't really understand the alpha architecture.)

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
---
 arch/alpha/include/asm/io.h |  2 ++
 arch/alpha/kernel/io.c      | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index ff4049155c84..15588092c062 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -493,8 +493,10 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
 
 #define ioread16be(p) be16_to_cpu(ioread16(p))
 #define ioread32be(p) be32_to_cpu(ioread32(p))
+#define ioread64be(p) be64_to_cpu(ioread64(p))
 #define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
 #define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
+#define iowrite64be(v,p) iowrite32(cpu_to_be64(v), (p))
 
 #define inb_p		inb
 #define inw_p		inw
diff --git a/arch/alpha/kernel/io.c b/arch/alpha/kernel/io.c
index 19c5875ab398..8c28026f7849 100644
--- a/arch/alpha/kernel/io.c
+++ b/arch/alpha/kernel/io.c
@@ -59,6 +59,24 @@ EXPORT_SYMBOL(iowrite8);
 EXPORT_SYMBOL(iowrite16);
 EXPORT_SYMBOL(iowrite32);
 
+u64 ioread64(void __iomem *addr)
+{
+	u64 low, high;
+
+	low = ioread32(addr);
+	high = ioread32(addr + sizeof(u32));
+	return low | (high << 32);
+}
+
+void iowrite64(u64 val, void __iomem *addr)
+{
+	iowrite32(val, addr);
+	iowrite32(val >> 32, addr + sizeof(u32));
+}
+
+EXPORT_SYMBOL(ioread64);
+EXPORT_SYMBOL(iowrite64);
+
 u8 inb(unsigned long port)
 {
 	return ioread8(ioport_map(port, 1));
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Logan Gunthorpe <logang@deltatee.com> - 2017-06-22 19:00 +0200
  Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations "Stephen  Bates" <sbates@raithlin.com> - 2017-06-22 19:30 +0200
    Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Logan Gunthorpe <logang@deltatee.com> - 2017-06-22 19:40 +0200
  Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64  implementations Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-22 22:10 +0200
    Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Logan Gunthorpe <logang@deltatee.com> - 2017-06-22 22:20 +0200
      Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Arnd Bergmann <arnd@arndb.de> - 2017-06-22 23:10 +0200
        Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Logan Gunthorpe <logang@deltatee.com> - 2017-06-22 23:20 +0200
  Re: [PATCH 4/7] alpha: provide ioread64 and iowrite64 implementations Richard Henderson <rth@twiddle.net> - 2017-06-22 23:30 +0200

csiph-web