blob: 11d7e840d9139357d17bf6be38e210cfbcb44a82 [file] [log] [blame]
Christoph Hellwig2f8e2c82015-08-28 09:27:14 +02001#ifndef _LINUX_IO_64_NONATOMIC_HI_LO_H_
2#define _LINUX_IO_64_NONATOMIC_HI_LO_H_
Hitoshi Mitake797a7962012-02-07 11:45:33 +09003
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
Jason Baron3a044172014-07-04 13:27:04 +02007static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
Hitoshi Mitake797a7962012-02-07 11:45:33 +09008{
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}
Hitoshi Mitake797a7962012-02-07 11:45:33 +090017
Jason Baron3a044172014-07-04 13:27:04 +020018static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
Hitoshi Mitake797a7962012-02-07 11:45:33 +090019{
20 writel(val >> 32, addr + 4);
21 writel(val, addr);
22}
Jason Baron3a044172014-07-04 13:27:04 +020023
24#ifndef readq
25#define readq hi_lo_readq
26#endif
27
28#ifndef writeq
29#define writeq hi_lo_writeq
Hitoshi Mitake797a7962012-02-07 11:45:33 +090030#endif
31
Christoph Hellwig2f8e2c82015-08-28 09:27:14 +020032#endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */