Hi, On 6/2/25 14:13, Sascha Hauer wrote: > On Tue, May 27, 2025 at 11:22:52PM +0200, Ahmad Fatoum wrote: >> From: Ahmad Fatoum <ah...@a3f.at> >> >> We shouldn't have any physical addresses exceeding 32-bit on 64-bit >> systems, > > Why? Aren't 64bit physical addresses normal on 64bit systems?
Sorry, other way round. We shouldn't have 64-bit addresses on 32-bit systems. > >> especially as barebox doesn't implement ARM32 LPAE. > > This patch doesn't seem to be Arm specific, so why mention ARM32 LPAE > here? > > I think I am missing something here. Sorry for the Switcharoo. Can you fixup or should I resend? Thanks, Ahmad > > Sascha > >> >> Add helpers to convert between the types to be able to drop casts and >> checks in the code. >> >> Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org> >> --- >> include/efi/types.h | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/include/efi/types.h b/include/efi/types.h >> index c845d08d62b6..85aaf32f8f1d 100644 >> --- a/include/efi/types.h >> +++ b/include/efi/types.h >> @@ -2,7 +2,11 @@ >> #ifndef _EFI_TYPES_H_ >> #define _EFI_TYPES_H_ >> >> +#ifndef __ASSEMBLY__ >> + >> #include <linux/types.h> >> +#include <linux/limits.h> >> +#include <linux/stddef.h> >> #include <linux/compiler.h> >> #include <linux/uuid.h> >> >> @@ -65,4 +69,17 @@ union efi_ip_address { >> struct efi_ipv6_address v6; >> }; >> >> +static inline void *efi_phys_to_virt(efi_physical_addr_t addr) >> +{ >> + if (addr > UINTPTR_MAX) >> + __builtin_trap(); >> + >> + return (void *)(uintptr_t)addr; >> +} >> + >> +static inline efi_physical_addr_t efi_virt_to_phys(const void *addr) >> +{ >> + return (uintptr_t)addr; >> +} >> + >> #endif >> -- >> 2.39.5 >> >> >> > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |