gem5: Add readq and writeq support to arch/arm/include/asm/io.h
Update asm/io.h to provide known working implementations
for writeq and readq to work with NVMe and IGB device drivers
which perform 64-bit IO reads and writes.
Signed-off-by: Geoffrey Blake <Geoffrey.Blake@arm.com>
Change-Id: I1ec9bad6fc9d0ef4eda2f71200bc3e08460dcacf
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 2cfbc53..318bc3b 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -101,6 +101,7 @@
: : "Qo" (*(volatile u32 __force *)addr), "r" (val));
}
+#define __raw_writeq(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned long long __force *)(a) = (v)))
#define __raw_readb __raw_readb
static inline u8 __raw_readb(const volatile void __iomem *addr)
{
@@ -121,6 +122,7 @@
return val;
}
+#define __raw_readq(a) (__chk_io_ptr(a), *(volatile unsigned long long __force *)(a))
/*
* Architecture ioremap implementation.
*/
@@ -300,18 +302,23 @@
__raw_readw(c)); __r; })
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
__raw_readl(c)); __r; })
+#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64) \
+ __raw_readq(c)); __r; })
#define writeb_relaxed(v,c) __raw_writeb(v,c)
#define writew_relaxed(v,c) __raw_writew((__force u16) cpu_to_le16(v),c)
#define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
+#define writeq_relaxed(v,c) __raw_writeq((__force u64) cpu_to_le64(v),c)
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
+#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(); __v; })
#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
+#define writeq(v,c) ({ __iowmb(); writeq_relaxed(v,c); })
#define readsb(p,d,l) __raw_readsb(p,d,l)
#define readsw(p,d,l) __raw_readsw(p,d,l)