diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2022-07-26 13:24:12 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-08 15:22:53 +0200 |
commit | f6eccbf5924514087074129dca102f8b632c3f17 (patch) | |
tree | 44c2e6f814f4f931cc0c65c95721ebbbe01ddbdf /include/asm-generic | |
parent | 2a3008a347021bc2d3b91e1b252b328f64db7ffe (diff) | |
download | barebox-f6eccbf5924514087074129dca102f8b632c3f17.tar.gz barebox-f6eccbf5924514087074129dca102f8b632c3f17.tar.xz |
asm-generic: provide phys_to_virt() and virt_to_phys()
The arm, riscv, sandbox and x86 architectures use
just the same phys_to_virt()/virt_to_phys() implementation.
Only the mips architecture has its own special implementation.
So we can move phys_to_virt() and virt_to_phys()
generic implementation to include/asm-generic/io.h.
Use override functions way introduced in the 9216efafc52ff99e
("asm-generic/io.h: Reconcile I/O accessor overrides")
linux kernel commit.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Link: https://lore.barebox.org/20220726102412.1104232-1-antonynpavlov@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/io.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 47f8c3ec1b..e41b4df403 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -421,6 +421,26 @@ static inline void iowrite64be(u64 value, volatile void __iomem *addr) #endif #endif /* CONFIG_64BIT */ +/* + * Change virtual addresses to physical addresses and vv. + * These are pretty trivial + */ +#ifndef virt_to_phys +#define virt_to_phys virt_to_phys +static inline unsigned long virt_to_phys(volatile void *mem) +{ + return (unsigned long)mem; +} +#endif + +#ifndef phys_to_virt +#define phys_to_virt phys_to_virt +static inline void *phys_to_virt(unsigned long phys) +{ + return (void *)phys; +} +#endif + #ifndef IOMEM #define IOMEM(addr) ((void __force __iomem *)(addr)) #endif |