summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-05 22:27:19 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-05 22:27:19 +0000
commitb4221611e98e591e0fea9cf5ff94545a5cf51202 (patch)
treecd1f1d8847df7b390350f8174d3496a178d5ee5c /MdePkg
parent4e361093575831434922665cf2ed30fbeddf1c7b (diff)
downloadedk2-platforms-b4221611e98e591e0fea9cf5ff94545a5cf51202.tar.xz
Add Doxygen style comments to the EFI_SIZE_TO_PAGES() and EFI_PAGES_TO_SIZE() macros. Clarify that the Size and Pages parameters to these macros are assumed to be type UINTN.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11010 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Uefi/UefiBaseType.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h
index 5b8a762072..e24168fb51 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -181,20 +181,38 @@ typedef union {
//
// The EFI memory allocation functions work in units of EFI_PAGEs that are
-// 4K. This should in no way be confused with the page size of the processor.
+// 4KB. This should in no way be confused with the page size of the processor.
// An EFI_PAGE is just the quanta of memory in EFI.
//
-#define EFI_PAGE_SIZE 0x1000
+#define EFI_PAGE_SIZE SIZE_4KB
#define EFI_PAGE_MASK 0xFFF
#define EFI_PAGE_SHIFT 12
-//
-// It is expected that a parameter for the following two macros is of type UINTN.
-// Be careful to pass a UINT64 parameter because 32-bit build break may happen
-// if << or >> shift operations are performed on a 64-bit integer with 32-bit C compiler.
-//
-#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
-#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)
+/**
+ Macro that converts a size, in bytes, to a number of EFI_PAGESs.
+
+ @param Size A size in bytes. This parameter is assumed to be type UINTN.
+ Passing in a parameter that is larger than UINTN may produce
+ unexpected results.
+
+ @return The number of EFI_PAGESs associated with the number of bytes specified
+ by Size.
+
+**/
+#define EFI_SIZE_TO_PAGES(Size) (((Size) >> EFI_PAGE_SHIFT) + (((Size) & EFI_PAGE_MASK) ? 1 : 0))
+
+/**
+ Macro that converts a number of EFI_PAGEs to a size in bytes.
+
+ @param Pages The number of EFI_PAGES. This parameter is assumed to be
+ type UINTN. Passing in a parameter that is larger than
+ UINTN may produce unexpected results.
+
+ @return The number of bytes associated with the number of EFI_PAGEs specified
+ by Pages.
+
+**/
+#define EFI_PAGES_TO_SIZE(Pages) ((Pages) << EFI_PAGE_SHIFT)
///
/// PE32+ Machine type for IA32 UEFI images.