Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszer...
[linux-2.6-block.git] / include / linux / io-64-nonatomic-hi-lo.h
CommitLineData
2f8e2c87
CH
1#ifndef _LINUX_IO_64_NONATOMIC_HI_LO_H_
2#define _LINUX_IO_64_NONATOMIC_HI_LO_H_
797a796a
HM
3
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
3a044178 7static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
797a796a
HM
8{
9 const volatile u32 __iomem *p = addr;
10 u32 low, high;
11
12 high = readl(p + 1);
13 low = readl(p);
14
15 return low + ((u64)high << 32);
16}
797a796a 17
3a044178 18static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
797a796a
HM
19{
20 writel(val >> 32, addr + 4);
21 writel(val, addr);
22}
3a044178 23
e511267b
RM
24static inline __u64 hi_lo_readq_relaxed(const volatile void __iomem *addr)
25{
26 const volatile u32 __iomem *p = addr;
27 u32 low, high;
28
29 high = readl_relaxed(p + 1);
30 low = readl_relaxed(p);
31
32 return low + ((u64)high << 32);
33}
34
35static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)
36{
37 writel_relaxed(val >> 32, addr + 4);
38 writel_relaxed(val, addr);
39}
40
3a044178
JB
41#ifndef readq
42#define readq hi_lo_readq
43#endif
44
45#ifndef writeq
46#define writeq hi_lo_writeq
797a796a
HM
47#endif
48
e511267b
RM
49#ifndef readq_relaxed
50#define readq_relaxed hi_lo_readq_relaxed
51#endif
52
53#ifndef writeq_relaxed
54#define writeq_relaxed hi_lo_writeq_relaxed
55#endif
56
2f8e2c87 57#endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */