[PATCH 076/112] efi: improve usability of EFI_PAGE_* macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux