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