[PATCH v2 076/113] efi: improve usability of EFI_PAGE_* macros
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 4 11:00:01 PST 2024
EFI code may want to mask addresses to check if they are page aligned.
Add a macro that masks the lower bits and while at it turn the type of
EFI_PAGE_SIZE to be 64 bits, so we avoid issues of truncation during
multiplication with a 32 bit value.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/efi.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/efi.h b/include/efi.h
index a6dbc14ff3d9..a73c96ef3a82 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -117,7 +117,8 @@ enum efi_memory_type {
#define EFI_MEMORY_DESCRIPTOR_VERSION 1
#define EFI_PAGE_SHIFT 12
-#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
+#define EFI_PAGE_SIZE (1ULL << EFI_PAGE_SHIFT)
+#define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1)
/*
* Allocation types for calls to boottime->allocate_pages.
--
2.39.2
More information about the barebox
mailing list