]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2f8e2c87 CH |
2 | #ifndef _LINUX_IO_64_NONATOMIC_LO_HI_H_ |
3 | #define _LINUX_IO_64_NONATOMIC_LO_HI_H_ | |
797a796a HM |
4 | |
5 | #include <linux/io.h> | |
6 | #include <asm-generic/int-ll64.h> | |
7 | ||
3a044178 | 8 | static inline __u64 lo_hi_readq(const volatile void __iomem *addr) |
797a796a HM |
9 | { |
10 | const volatile u32 __iomem *p = addr; | |
11 | u32 low, high; | |
12 | ||
13 | low = readl(p); | |
14 | high = readl(p + 1); | |
15 | ||
16 | return low + ((u64)high << 32); | |
17 | } | |
797a796a | 18 | |
3a044178 | 19 | static inline void lo_hi_writeq(__u64 val, volatile void __iomem *addr) |
797a796a HM |
20 | { |
21 | writel(val, addr); | |
22 | writel(val >> 32, addr + 4); | |
23 | } | |
3a044178 | 24 | |
e511267b RM |
25 | static inline __u64 lo_hi_readq_relaxed(const volatile void __iomem *addr) |
26 | { | |
27 | const volatile u32 __iomem *p = addr; | |
28 | u32 low, high; | |
29 | ||
30 | low = readl_relaxed(p); | |
31 | high = readl_relaxed(p + 1); | |
32 | ||
33 | return low + ((u64)high << 32); | |
34 | } | |
35 | ||
36 | static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr) | |
37 | { | |
38 | writel_relaxed(val, addr); | |
39 | writel_relaxed(val >> 32, addr + 4); | |
40 | } | |
41 | ||
3a044178 JB |
42 | #ifndef readq |
43 | #define readq lo_hi_readq | |
44 | #endif | |
45 | ||
46 | #ifndef writeq | |
47 | #define writeq lo_hi_writeq | |
797a796a HM |
48 | #endif |
49 | ||
e511267b RM |
50 | #ifndef readq_relaxed |
51 | #define readq_relaxed lo_hi_readq_relaxed | |
52 | #endif | |
53 | ||
54 | #ifndef writeq_relaxed | |
55 | #define writeq_relaxed lo_hi_writeq_relaxed | |
56 | #endif | |
57 | ||
2f8e2c87 | 58 | #endif /* _LINUX_IO_64_NONATOMIC_LO_HI_H_ */ |