Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / io-64-nonatomic-hi-lo.h
blob862d786a904f3a3f1819eedf94238928388c3353
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_IO_64_NONATOMIC_HI_LO_H_
3 #define _LINUX_IO_64_NONATOMIC_HI_LO_H_
5 #include <linux/io.h>
6 #include <asm-generic/int-ll64.h>
8 static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
10 const volatile u32 __iomem *p = addr;
11 u32 low, high;
13 high = readl(p + 1);
14 low = readl(p);
16 return low + ((u64)high << 32);
19 static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
21 writel(val >> 32, addr + 4);
22 writel(val, addr);
25 static inline __u64 hi_lo_readq_relaxed(const volatile void __iomem *addr)
27 const volatile u32 __iomem *p = addr;
28 u32 low, high;
30 high = readl_relaxed(p + 1);
31 low = readl_relaxed(p);
33 return low + ((u64)high << 32);
36 static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)
38 writel_relaxed(val >> 32, addr + 4);
39 writel_relaxed(val, addr);
42 #ifndef readq
43 #define readq hi_lo_readq
44 #endif
46 #ifndef writeq
47 #define writeq hi_lo_writeq
48 #endif
50 #ifndef readq_relaxed
51 #define readq_relaxed hi_lo_readq_relaxed
52 #endif
54 #ifndef writeq_relaxed
55 #define writeq_relaxed hi_lo_writeq_relaxed
56 #endif
58 #endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */