|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
| 2 | + |
| 3 | +#include <linux/io.h> |
| 4 | + |
| 5 | +u8 rust_helper_readb(const volatile void __iomem *addr) |
| 6 | +{ |
| 7 | + return readb(addr); |
| 8 | +} |
| 9 | +EXPORT_SYMBOL_GPL(rust_helper_readb); |
| 10 | + |
| 11 | +u16 rust_helper_readw(const volatile void __iomem *addr) |
| 12 | +{ |
| 13 | + return readw(addr); |
| 14 | +} |
| 15 | +EXPORT_SYMBOL_GPL(rust_helper_readw); |
| 16 | + |
| 17 | +u32 rust_helper_readl(const volatile void __iomem *addr) |
| 18 | +{ |
| 19 | + return readl(addr); |
| 20 | +} |
| 21 | +EXPORT_SYMBOL_GPL(rust_helper_readl); |
| 22 | + |
| 23 | +#ifdef CONFIG_64BIT |
| 24 | +u64 rust_helper_readq(const volatile void __iomem *addr) |
| 25 | +{ |
| 26 | + return readq(addr); |
| 27 | +} |
| 28 | +EXPORT_SYMBOL_GPL(rust_helper_readq); |
| 29 | +#endif |
| 30 | + |
| 31 | +void rust_helper_writeb(u8 value, volatile void __iomem *addr) |
| 32 | +{ |
| 33 | + writeb(value, addr); |
| 34 | +} |
| 35 | +EXPORT_SYMBOL_GPL(rust_helper_writeb); |
| 36 | + |
| 37 | +void rust_helper_writew(u16 value, volatile void __iomem *addr) |
| 38 | +{ |
| 39 | + writew(value, addr); |
| 40 | +} |
| 41 | +EXPORT_SYMBOL_GPL(rust_helper_writew); |
| 42 | + |
| 43 | +void rust_helper_writel(u32 value, volatile void __iomem *addr) |
| 44 | +{ |
| 45 | + writel(value, addr); |
| 46 | +} |
| 47 | +EXPORT_SYMBOL_GPL(rust_helper_writel); |
| 48 | + |
| 49 | +#ifdef CONFIG_64BIT |
| 50 | +void rust_helper_writeq(u64 value, volatile void __iomem *addr) |
| 51 | +{ |
| 52 | + writeq(value, addr); |
| 53 | +} |
| 54 | +EXPORT_SYMBOL_GPL(rust_helper_writeq); |
| 55 | +#endif |
| 56 | + |
| 57 | +u8 rust_helper_readb_relaxed(const volatile void __iomem *addr) |
| 58 | +{ |
| 59 | + return readb_relaxed(addr); |
| 60 | +} |
| 61 | +EXPORT_SYMBOL_GPL(rust_helper_readb_relaxed); |
| 62 | + |
| 63 | +u16 rust_helper_readw_relaxed(const volatile void __iomem *addr) |
| 64 | +{ |
| 65 | + return readw_relaxed(addr); |
| 66 | +} |
| 67 | +EXPORT_SYMBOL_GPL(rust_helper_readw_relaxed); |
| 68 | + |
| 69 | +u32 rust_helper_readl_relaxed(const volatile void __iomem *addr) |
| 70 | +{ |
| 71 | + return readl_relaxed(addr); |
| 72 | +} |
| 73 | +EXPORT_SYMBOL_GPL(rust_helper_readl_relaxed); |
| 74 | + |
| 75 | +#ifdef CONFIG_64BIT |
| 76 | +u64 rust_helper_readq_relaxed(const volatile void __iomem *addr) |
| 77 | +{ |
| 78 | + return readq_relaxed(addr); |
| 79 | +} |
| 80 | +EXPORT_SYMBOL_GPL(rust_helper_readq_relaxed); |
| 81 | +#endif |
| 82 | + |
| 83 | +void rust_helper_writeb_relaxed(u8 value, volatile void __iomem *addr) |
| 84 | +{ |
| 85 | + writeb_relaxed(value, addr); |
| 86 | +} |
| 87 | +EXPORT_SYMBOL_GPL(rust_helper_writeb_relaxed); |
| 88 | + |
| 89 | +void rust_helper_writew_relaxed(u16 value, volatile void __iomem *addr) |
| 90 | +{ |
| 91 | + writew_relaxed(value, addr); |
| 92 | +} |
| 93 | +EXPORT_SYMBOL_GPL(rust_helper_writew_relaxed); |
| 94 | + |
| 95 | +void rust_helper_writel_relaxed(u32 value, volatile void __iomem *addr) |
| 96 | +{ |
| 97 | + writel_relaxed(value, addr); |
| 98 | +} |
| 99 | +EXPORT_SYMBOL_GPL(rust_helper_writel_relaxed); |
| 100 | + |
| 101 | +#ifdef CONFIG_64BIT |
| 102 | +void rust_helper_writeq_relaxed(u64 value, volatile void __iomem *addr) |
| 103 | +{ |
| 104 | + writeq_relaxed(value, addr); |
| 105 | +} |
| 106 | +EXPORT_SYMBOL_GPL(rust_helper_writeq_relaxed); |
| 107 | +#endif |
| 108 | + |
| 109 | +void rust_helper_memcpy_fromio(void *to, const volatile void __iomem *from, long count) |
| 110 | +{ |
| 111 | + memcpy_fromio(to, from, count); |
| 112 | +} |
| 113 | +EXPORT_SYMBOL_GPL(rust_helper_memcpy_fromio); |
0 commit comments