]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Mem/pool.c
Add doxygen style comments for functions in DxeMain.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Mem / pool.c
index 664df1422ad506f162e598887281ec969f2d7fa8..1adaa1f26970536ae97381617165b5b852112283 100644 (file)
@@ -1,6 +1,8 @@
-/*++\r
+/** @file \r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+  UEFI Memory pool management functions.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -9,17 +11,7 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-  pool.c\r
-\r
-Abstract:\r
-\r
-  EFI Memory pool management\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
 \r
 #include <DxeMain.h>\r
 \r
@@ -85,25 +77,15 @@ LIST_ENTRY      PoolHeadList;
 //\r
 //\r
 \r
+\r
+/**\r
+  Called to initialize the pool.\r
+\r
+**/\r
 VOID\r
 CoreInitializePool (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Called to initialize the pool.\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   UINTN  Type;\r
   UINTN  Index;\r
@@ -119,26 +101,20 @@ Returns:
   InitializeListHead (&PoolHeadList);\r
 }\r
 \r
-STATIC\r
-POOL *\r
-LookupPoolHead (\r
-  IN EFI_MEMORY_TYPE  MemoryType\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Look up pool head for specified memory type.\r
 \r
-Arguments:\r
+  @param  MemoryType             Memory type of which pool head is looked for \r
 \r
-  MemoryType      - Memory type of which pool head is looked for\r
+  @return Pointer of Corresponding pool head.\r
 \r
-Returns:\r
-\r
-  Pointer of Corresponding pool head.\r
-\r
---*/\r
+**/\r
+STATIC\r
+POOL *\r
+LookupPoolHead (\r
+  IN EFI_MEMORY_TYPE  MemoryType\r
+  )\r
 {\r
   LIST_ENTRY      *Link;\r
   POOL            *Pool;\r
@@ -179,6 +155,20 @@ Returns:
 \r
  \r
 \r
+\r
+/**\r
+  Allocate pool of a particular type.\r
+\r
+  @param  PoolType               Type of pool to allocate \r
+  @param  Size                   The amount of pool to allocate \r
+  @param  Buffer                 The address to return a pointer to the allocated \r
+                                 pool \r
+\r
+  @retval EFI_INVALID_PARAMETER  PoolType not valid \r
+  @retval EFI_OUT_OF_RESOURCES   Size exceeds max pool size or allocation failed. \r
+  @retval EFI_SUCCESS            Pool successfully allocated.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreAllocatePool (\r
@@ -186,29 +176,6 @@ CoreAllocatePool (
   IN UINTN            Size,\r
   OUT VOID            **Buffer\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Allocate pool of a particular type.\r
-\r
-Arguments:\r
-\r
-  PoolType    - Type of pool to allocate\r
-\r
-  Size        - The amount of pool to allocate\r
-\r
-  Buffer      - The address to return a pointer to the allocated pool\r
-\r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER     - PoolType not valid\r
-  \r
-  EFI_OUT_OF_RESOURCES      - Size exceeds max pool size or allocation failed.  \r
-  \r
-  EFI_SUCCESS               - Pool successfully allocated.\r
-\r
---*/\r
 {\r
   EFI_STATUS    Status;\r
 \r
@@ -244,31 +211,22 @@ Returns:
 }\r
 \r
 \r
-VOID *\r
-CoreAllocatePoolI (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            Size\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Internal function to allocate pool of a particular type.\r
-\r
   Caller must have the memory lock held\r
 \r
+  @param  PoolType               Type of pool to allocate \r
+  @param  Size                   The amount of pool to allocate \r
 \r
-Arguments:\r
-\r
-  PoolType    - Type of pool to allocate\r
-\r
-  Size        - The amount of pool to allocate\r
-\r
-Returns:\r
-\r
-  The allocate pool, or NULL\r
+  @return The allocate pool, or NULL\r
 \r
---*/\r
+**/\r
+VOID *\r
+CoreAllocatePoolI (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            Size\r
+  )\r
 {\r
   POOL        *Pool;\r
   POOL_FREE   *Free;\r
@@ -278,7 +236,7 @@ Returns:
   VOID        *Buffer;\r
   UINTN       Index;\r
   UINTN       FSize;\r
-  UINTN       offset;\r
+  UINTN       Offset;\r
   UINTN       Adjustment;\r
   UINTN       NoPages;\r
 \r
@@ -330,23 +288,23 @@ Returns:
     //\r
     // Carve up new page into free pool blocks\r
     //\r
-    offset = 0;\r
-    while (offset < DEFAULT_PAGE_ALLOCATION) {\r
+    Offset = 0;\r
+    while (Offset < DEFAULT_PAGE_ALLOCATION) {\r
       ASSERT (Index < MAX_POOL_LIST);\r
       FSize = LIST_TO_SIZE(Index);\r
 \r
-      while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
-        Free = (POOL_FREE *) &NewPage[offset];          \r
+      while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
+        Free = (POOL_FREE *) &NewPage[Offset];          \r
         Free->Signature = POOL_FREE_SIGNATURE;\r
         Free->Index     = (UINT32)Index;\r
         InsertHeadList (&Pool->FreeList[Index], &Free->Link);\r
-        offset += FSize;\r
+        Offset += FSize;\r
       }\r
 \r
       Index -= 1;\r
     }\r
 \r
-    ASSERT (offset == DEFAULT_PAGE_ALLOCATION);\r
+    ASSERT (Offset == DEFAULT_PAGE_ALLOCATION);\r
     Index = SIZE_TO_LIST(Size);\r
   }\r
 \r
@@ -376,7 +334,7 @@ Done:
     DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD);\r
 \r
     DEBUG (\r
-      (EFI_D_POOL,\r
+      (DEBUG_POOL,\r
       "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n",\r
        PoolType, \r
        Buffer, \r
@@ -390,7 +348,7 @@ Done:
     Pool->Used += Size;\r
 \r
   } else {\r
-    DEBUG ((EFI_D_ERROR | EFI_D_POOL, "AllocatePool: failed to allocate %d bytes\n", Size));\r
+    DEBUG ((DEBUG_ERROR | DEBUG_POOL, "AllocatePool: failed to allocate %d bytes\n", Size));\r
   }\r
 \r
   return Buffer;\r
@@ -398,28 +356,21 @@ Done:
   \r
 \r
 \r
-EFI_STATUS\r
-EFIAPI\r
-CoreFreePool (\r
-  IN VOID        *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Frees pool.\r
 \r
-Arguments:\r
+  @param  Buffer                 The allocated pool entry to free \r
 \r
-  Buffer      - The allocated pool entry to free\r
+  @retval EFI_INVALID_PARAMETER  Buffer is not a valid value. \r
+  @retval EFI_SUCCESS            Pool successfully freed.\r
 \r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER   - Buffer is not a valid value.\r
-  \r
-  EFI_SUCCESS             - Pool successfully freed.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreFreePool (\r
+  IN VOID        *Buffer\r
+  )\r
 {\r
   EFI_STATUS Status;\r
 \r
@@ -434,30 +385,21 @@ Returns:
 }\r
 \r
 \r
-EFI_STATUS\r
-CoreFreePoolI (\r
-  IN VOID       *Buffer\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
 \r
+/**\r
   Internal function to free a pool entry.\r
-\r
   Caller must have the memory lock held\r
 \r
+  @param  Buffer                 The allocated pool entry to free \r
 \r
-Arguments:\r
+  @retval EFI_INVALID_PARAMETER  Buffer not valid \r
+  @retval EFI_SUCCESS            Buffer successfully freed.\r
 \r
-  Buffer      - The allocated pool entry to free\r
-\r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER     - Buffer not valid\r
-  \r
-  EFI_SUCCESS               - Buffer successfully freed.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+CoreFreePoolI (\r
+  IN VOID       *Buffer\r
+  )\r
 {\r
   POOL        *Pool;\r
   POOL_HEAD   *Head;\r
@@ -468,7 +410,7 @@ Returns:
   UINTN       Size;\r
   CHAR8       *NewPage;\r
   UINTN       FSize;\r
-  UINTN       offset;\r
+  UINTN       Offset;\r
   BOOLEAN     AllFree;\r
 \r
   ASSERT(NULL != Buffer);\r
@@ -509,7 +451,7 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
   Pool->Used -= Size;\r
-  DEBUG ((EFI_D_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used));\r
+  DEBUG ((DEBUG_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used));\r
 \r
   //\r
   // Determine the pool list \r
@@ -553,17 +495,17 @@ Returns:
       Index = Free->Index;\r
 \r
       AllFree = TRUE;\r
-      offset = 0;\r
+      Offset = 0;\r
       \r
-      while ((offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) {\r
+      while ((Offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) {\r
         FSize = LIST_TO_SIZE(Index);\r
-        while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
-          Free = (POOL_FREE *) &NewPage[offset];\r
+        while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
+          Free = (POOL_FREE *) &NewPage[Offset];\r
           ASSERT(NULL != Free);\r
           if (Free->Signature != POOL_FREE_SIGNATURE) {\r
             AllFree = FALSE;\r
           }\r
-          offset += FSize;\r
+          Offset += FSize;\r
         }\r
         Index -= 1;\r
       }\r
@@ -578,15 +520,15 @@ Returns:
         Free = (POOL_FREE *) &NewPage[0];\r
         ASSERT(NULL != Free);\r
         Index = Free->Index;\r
-        offset = 0;\r
+        Offset = 0;\r
         \r
-        while (offset < DEFAULT_PAGE_ALLOCATION) {\r
+        while (Offset < DEFAULT_PAGE_ALLOCATION) {\r
           FSize = LIST_TO_SIZE(Index);\r
-          while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
-            Free = (POOL_FREE *) &NewPage[offset];\r
+          while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
+            Free = (POOL_FREE *) &NewPage[Offset];\r
             ASSERT(NULL != Free);\r
             RemoveEntryList (&Free->Link);\r
-            offset += FSize;\r
+            Offset += FSize;\r
           }\r
           Index -= 1;\r
         }\r