Commit 75db1d84 authored by Rene de Jong's avatar Rene de Jong Committed by Chris Emmons

This patch introduces the possibility to read registers as 64 bit values.

The gem5 NVMe device adheres to that; but the io.h functions do not. This
has as consequence that the reading of those registers get split up in two
transactions of 32 bits. This is not supported by the NVMe device.

According to the NVMe spec, certain registers must be read as 64 bit values.
parent 3b014256
......@@ -50,10 +50,14 @@ extern void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set);
extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen);
extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
extern void __raw_writesl(void __iomem *addr, const void *data, int longlen);
/** NVME Support **/
#define __raw_writeq(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned long long __force *)(a) = (v)))
extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
/** NVME Support **/
#define __raw_readq(a) (__chk_io_ptr(a), *(volatile unsigned long long __force *)(a))
#if __LINUX_ARM_ARCH__ < 6
/*
......@@ -299,18 +303,24 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
__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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment