]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add Doxygen style comments to the EFI_SIZE_TO_PAGES() and EFI_PAGES_TO_SIZE() macros...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Nov 2010 22:27:19 +0000 (22:27 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Nov 2010 22:27:19 +0000 (22:27 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11010 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Uefi/UefiBaseType.h

index 5b8a7620728f6e899cd512864a0017d239a0b86c..e24168fb51d749d9e413c57135aeaae122975f59 100644 (file)
@@ -181,20 +181,38 @@ typedef union {
 \r
 //\r
 // The EFI memory allocation functions work in units of EFI_PAGEs that are\r
 \r
 //\r
 // The EFI memory allocation functions work in units of EFI_PAGEs that are\r
-// 4K. This should in no way be confused with the page size of the processor.\r
+// 4KB. This should in no way be confused with the page size of the processor.\r
 // An EFI_PAGE is just the quanta of memory in EFI.\r
 //\r
 // An EFI_PAGE is just the quanta of memory in EFI.\r
 //\r
-#define EFI_PAGE_SIZE             0x1000\r
+#define EFI_PAGE_SIZE             SIZE_4KB\r
 #define EFI_PAGE_MASK             0xFFF\r
 #define EFI_PAGE_SHIFT            12\r
 \r
 #define EFI_PAGE_MASK             0xFFF\r
 #define EFI_PAGE_SHIFT            12\r
 \r
-//\r
-// It is expected that a parameter for the following two macros is of type UINTN.\r
-// Be careful to pass a UINT64 parameter because 32-bit build break may happen\r
-// if << or >> shift operations are performed on a 64-bit integer with 32-bit C compiler.\r
-//\r
-#define EFI_SIZE_TO_PAGES(a)  (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))\r
-#define EFI_PAGES_TO_SIZE(a)   ( (a) << EFI_PAGE_SHIFT)\r
+/**\r
+  Macro that converts a size, in bytes, to a number of EFI_PAGESs.\r
+\r
+  @param  Size      A size in bytes.  This parameter is assumed to be type UINTN.  \r
+                    Passing in a parameter that is larger than UINTN may produce \r
+                    unexpected results.\r
+\r
+  @return  The number of EFI_PAGESs associated with the number of bytes specified\r
+           by Size.\r
+\r
+**/\r
+#define EFI_SIZE_TO_PAGES(Size)  (((Size) >> EFI_PAGE_SHIFT) + (((Size) & EFI_PAGE_MASK) ? 1 : 0))\r
+\r
+/**\r
+  Macro that converts a number of EFI_PAGEs to a size in bytes.\r
+\r
+  @param  Pages     The number of EFI_PAGES.  This parameter is assumed to be \r
+                    type UINTN.  Passing in a parameter that is larger than \r
+                    UINTN may produce unexpected results.\r
+\r
+  @return  The number of bytes associated with the number of EFI_PAGEs specified \r
+           by Pages.\r
+  \r
+**/\r
+#define EFI_PAGES_TO_SIZE(Pages)  ((Pages) << EFI_PAGE_SHIFT)\r
 \r
 ///\r
 /// PE32+ Machine type for IA32 UEFI images.\r
 \r
 ///\r
 /// PE32+ Machine type for IA32 UEFI images.\r