]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/SmmMemoryAllocationProfileLib/MemoryAllocationLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Library / SmmMemoryAllocationProfileLib / MemoryAllocationLib.c
index 2a18155e56060cf9fa116ae7410c5b62fb0a77b2..a1e6a3a7a1d953ebbd2d2eb704b2814fc3e1f61e 100644 (file)
@@ -1,25 +1,25 @@
 /** @file\r
-  Support routines for memory allocation routines based \r
+  Support routines for memory allocation routines based\r
   on SMM Services Table services for SMM phase drivers, with memory profile support.\r
-  \r
+\r
   The PI System Management Mode Core Interface Specification only allows the use\r
-  of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory \r
-  allocations through the SMM Services Table as the SMRAM space should be \r
+  of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory\r
+  allocations through the SMM Services Table as the SMRAM space should be\r
   reserved after BDS phase.  The functions in the Memory Allocation Library use\r
-  EfiBootServicesData as the default memory allocation type.  For this SMM \r
-  specific instance of the Memory Allocation Library, EfiRuntimeServicesData \r
-  is used as the default memory type for all allocations. In addition, \r
-  allocation for the Reserved memory types are not supported and will always \r
+  EfiBootServicesData as the default memory allocation type.  For this SMM\r
+  specific instance of the Memory Allocation Library, EfiRuntimeServicesData\r
+  is used as the default memory type for all allocations. In addition,\r
+  allocation for the Reserved memory types are not supported and will always\r
   return NULL.\r
 \r
-  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
-  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
-  http://opensource.org/licenses/bsd-license.php.                                            \r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  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
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
-  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
+  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
 **/\r
 \r
@@ -39,10 +39,10 @@ UINTN                 mSmramRangeCount;
 \r
 /**\r
   The constructor function caches SMRAM ranges that are present in the system.\r
-    \r
+\r
   It will ASSERT() if SMM Access2 Protocol doesn't exist.\r
   It will ASSERT() if SMRAM ranges can't be got.\r
-  It will ASSERT() if Resource can't be allocated for cache SMRAM range. \r
+  It will ASSERT() if Resource can't be allocated for cache SMRAM range.\r
   It will always return EFI_SUCCESS.\r
 \r
   @param  ImageHandle   The firmware allocated handle for the EFI image.\r
@@ -66,8 +66,8 @@ SmmMemoryAllocationLibConstructor (
   // Locate SMM Access2 Protocol\r
   //\r
   Status = gBS->LocateProtocol (\r
-                  &gEfiSmmAccess2ProtocolGuid, \r
-                  NULL, \r
+                  &gEfiSmmAccess2ProtocolGuid,\r
+                  NULL,\r
                   (VOID **)&SmmAccess\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
@@ -91,7 +91,7 @@ SmmMemoryAllocationLibConstructor (
 }\r
 \r
 /**\r
-  If SMM driver exits with an error, it must call this routine \r
+  If SMM driver exits with an error, it must call this routine\r
   to free the allocated resource before the exiting.\r
 \r
   @param[in]  ImageHandle   The firmware allocated handle for the EFI image.\r
@@ -128,7 +128,7 @@ BufferInSmram (
   UINTN  Index;\r
 \r
   for (Index = 0; Index < mSmramRangeCount; Index ++) {\r
-    if (((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer >= mSmramRanges[Index].CpuStart) && \r
+    if (((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer >= mSmramRanges[Index].CpuStart) &&\r
         ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer < (mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize))) {\r
       return TRUE;\r
     }\r
@@ -140,9 +140,9 @@ BufferInSmram (
 /**\r
   Allocates one or more 4KB pages of a certain memory type.\r
 \r
-  Allocates the number of 4KB pages of a certain memory type and returns a pointer \r
-  to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If \r
-  Pages is 0, then NULL is returned.   If there is not enough memory remaining to \r
+  Allocates the number of 4KB pages of a certain memory type and returns a pointer\r
+  to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If\r
+  Pages is 0, then NULL is returned.   If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  MemoryType            The type of memory to allocate.\r
@@ -153,12 +153,12 @@ BufferInSmram (
 **/\r
 VOID *\r
 InternalAllocatePages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages\r
   )\r
 {\r
   EFI_STATUS            Status;\r
-  EFI_PHYSICAL_ADDRESS  Memory; \r
+  EFI_PHYSICAL_ADDRESS  Memory;\r
 \r
   if (Pages == 0) {\r
     return NULL;\r
@@ -174,9 +174,9 @@ InternalAllocatePages (
 /**\r
   Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer \r
-  to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If \r
-  Pages is 0, then NULL is returned.  If there is not enough memory remaining to \r
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer\r
+  to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If\r
+  Pages is 0, then NULL is returned.  If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
@@ -209,9 +209,9 @@ AllocatePages (
 /**\r
   Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a \r
-  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  \r
-  If Pages is 0, then NULL is returned.  If there is not enough memory remaining \r
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a\r
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.\r
+  If Pages is 0, then NULL is returned.  If there is not enough memory remaining\r
   to satisfy the request, then NULL is returned.\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
@@ -244,9 +244,9 @@ AllocateRuntimePages (
 /**\r
   Allocates one or more 4KB pages of type EfiReservedMemoryType.\r
 \r
-  Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a \r
-  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.  \r
-  If Pages is 0, then NULL is returned.  If there is not enough memory remaining \r
+  Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a\r
+  pointer to the allocated buffer.  The buffer returned is aligned on a 4KB boundary.\r
+  If Pages is 0, then NULL is returned.  If there is not enough memory remaining\r
   to satisfy the request, then NULL is returned.\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
@@ -267,15 +267,15 @@ AllocateReservedPages (
   Frees one or more 4KB pages that were previously allocated with one of the page allocation\r
   functions in the Memory Allocation Library.\r
 \r
-  Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer.  \r
-  Buffer must have been allocated on a previous call to the page allocation services \r
-  of the Memory Allocation Library.  If it is not possible to free allocated pages, \r
+  Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer.\r
+  Buffer must have been allocated on a previous call to the page allocation services\r
+  of the Memory Allocation Library.  If it is not possible to free allocated pages,\r
   then this function will perform no actions.\r
-  \r
-  If Buffer was not allocated with a page allocation function in the Memory Allocation \r
+\r
+  If Buffer was not allocated with a page allocation function in the Memory Allocation\r
   Library, then ASSERT().\r
   If Pages is zero, then ASSERT().\r
\r
+\r
   @param  Buffer                The pointer to the buffer of pages to free.\r
   @param  Pages                 The number of 4 KB pages to free.\r
 \r
@@ -309,16 +309,16 @@ FreePages (
 /**\r
   Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r
 \r
-  Allocates the number of 4KB pages specified by Pages of a certain memory type \r
-  with an alignment specified by Alignment.  The allocated buffer is returned.  \r
-  If Pages is 0, then NULL is returned. If there is not enough memory at the \r
+  Allocates the number of 4KB pages specified by Pages of a certain memory type\r
+  with an alignment specified by Alignment.  The allocated buffer is returned.\r
+  If Pages is 0, then NULL is returned. If there is not enough memory at the\r
   specified alignment remaining to satisfy the request, then NULL is returned.\r
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
   If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r
 \r
   @param  MemoryType            The type of memory to allocate.\r
   @param  Pages                 The number of 4 KB pages to allocate.\r
-  @param  Alignment             The requested alignment of the allocation.  \r
+  @param  Alignment             The requested alignment of the allocation.\r
                                 Must be a power of two.\r
                                 If Alignment is zero, then byte alignment is used.\r
 \r
@@ -327,7 +327,7 @@ FreePages (
 **/\r
 VOID *\r
 InternalAllocateAlignedPages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages,\r
   IN UINTN            Alignment\r
   )\r
@@ -343,7 +343,7 @@ InternalAllocateAlignedPages (
   // Alignment must be a power of two or zero.\r
   //\r
   ASSERT ((Alignment & (Alignment - 1)) == 0);\r
\r
+\r
   if (Pages == 0) {\r
     return NULL;\r
   }\r
@@ -357,7 +357,7 @@ InternalAllocateAlignedPages (
     // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.\r
     //\r
     ASSERT (RealPages > Pages);\r
\r
+\r
     Status         = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);\r
     if (EFI_ERROR (Status)) {\r
       return NULL;\r
@@ -396,16 +396,16 @@ InternalAllocateAlignedPages (
 /**\r
   Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.\r
 \r
-  Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData \r
-  with an alignment specified by Alignment.  The allocated buffer is returned.  \r
-  If Pages is 0, then NULL is returned.  If there is not enough memory at the \r
+  Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData\r
+  with an alignment specified by Alignment.  The allocated buffer is returned.\r
+  If Pages is 0, then NULL is returned.  If there is not enough memory at the\r
   specified alignment remaining to satisfy the request, then NULL is returned.\r
-  \r
+\r
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
   If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
-  @param  Alignment             The requested alignment of the allocation.  \r
+  @param  Alignment             The requested alignment of the allocation.\r
                                 Must be a power of two.\r
                                 If Alignment is zero, then byte alignment is used.\r
 \r
@@ -438,16 +438,16 @@ AllocateAlignedPages (
 /**\r
   Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.\r
 \r
-  Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData \r
-  with an alignment specified by Alignment.  The allocated buffer is returned.  \r
-  If Pages is 0, then NULL is returned.  If there is not enough memory at the \r
+  Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData\r
+  with an alignment specified by Alignment.  The allocated buffer is returned.\r
+  If Pages is 0, then NULL is returned.  If there is not enough memory at the\r
   specified alignment remaining to satisfy the request, then NULL is returned.\r
-  \r
+\r
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
   If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
-  @param  Alignment             The requested alignment of the allocation.  \r
+  @param  Alignment             The requested alignment of the allocation.\r
                                 Must be a power of two.\r
                                 If Alignment is zero, then byte alignment is used.\r
 \r
@@ -480,16 +480,16 @@ AllocateAlignedRuntimePages (
 /**\r
   Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.\r
 \r
-  Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType \r
-  with an alignment specified by Alignment.  The allocated buffer is returned.  \r
-  If Pages is 0, then NULL is returned.  If there is not enough memory at the \r
+  Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType\r
+  with an alignment specified by Alignment.  The allocated buffer is returned.\r
+  If Pages is 0, then NULL is returned.  If there is not enough memory at the\r
   specified alignment remaining to satisfy the request, then NULL is returned.\r
-  \r
+\r
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
   If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r
 \r
   @param  Pages                 The number of 4 KB pages to allocate.\r
-  @param  Alignment             The requested alignment of the allocation.  \r
+  @param  Alignment             The requested alignment of the allocation.\r
                                 Must be a power of two.\r
                                 If Alignment is zero, then byte alignment is used.\r
 \r
@@ -510,15 +510,15 @@ AllocateAlignedReservedPages (
   Frees one or more 4KB pages that were previously allocated with one of the aligned page\r
   allocation functions in the Memory Allocation Library.\r
 \r
-  Frees the number of 4KB pages specified by Pages from the buffer specified by \r
-  Buffer.  Buffer must have been allocated on a previous call to the aligned page \r
-  allocation services of the Memory Allocation Library.  If it is not possible to \r
+  Frees the number of 4KB pages specified by Pages from the buffer specified by\r
+  Buffer.  Buffer must have been allocated on a previous call to the aligned page\r
+  allocation services of the Memory Allocation Library.  If it is not possible to\r
   free allocated pages, then this function will perform no actions.\r
-  \r
-  If Buffer was not allocated with an aligned page allocation function in the \r
+\r
+  If Buffer was not allocated with an aligned page allocation function in the\r
   Memory Allocation Library, then ASSERT().\r
   If Pages is zero, then ASSERT().\r
-  \r
+\r
   @param  Buffer                The pointer to the buffer of pages to free.\r
   @param  Pages                 The number of 4 KB pages to free.\r
 \r
@@ -552,9 +552,9 @@ FreeAlignedPages (
 /**\r
   Allocates a buffer of a certain pool type.\r
 \r
-  Allocates the number bytes specified by AllocationSize of a certain pool type \r
-  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a \r
-  valid buffer of 0 size is returned.  If there is not enough memory remaining to \r
+  Allocates the number bytes specified by AllocationSize of a certain pool type\r
+  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a\r
+  valid buffer of 0 size is returned.  If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  MemoryType            The type of memory to allocate.\r
@@ -565,7 +565,7 @@ FreeAlignedPages (
 **/\r
 VOID *\r
 InternalAllocatePool (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            AllocationSize\r
   )\r
 {\r
@@ -582,9 +582,9 @@ InternalAllocatePool (
 /**\r
   Allocates a buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData \r
-  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a \r
-  valid buffer of 0 size is returned.  If there is not enough memory remaining to \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData\r
+  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a\r
+  valid buffer of 0 size is returned.  If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate.\r
@@ -617,9 +617,9 @@ AllocatePool (
 /**\r
   Allocates a buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData \r
-  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a \r
-  valid buffer of 0 size is returned.  If there is not enough memory remaining to \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData\r
+  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a\r
+  valid buffer of 0 size is returned.  If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate.\r
@@ -652,9 +652,9 @@ AllocateRuntimePool (
 /**\r
   Allocates a buffer of type EfiReservedMemoryType.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType \r
-  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a \r
-  valid buffer of 0 size is returned.  If there is not enough memory remaining to \r
+  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType\r
+  and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a\r
+  valid buffer of 0 size is returned.  If there is not enough memory remaining to\r
   satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate.\r
@@ -674,9 +674,9 @@ AllocateReservedPool (
 /**\r
   Allocates and zeros a buffer of a certain pool type.\r
 \r
-  Allocates the number bytes specified by AllocationSize of a certain pool type, \r
-  clears the buffer with zeros, and returns a pointer to the allocated buffer.  \r
-  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is \r
+  Allocates the number bytes specified by AllocationSize of a certain pool type,\r
+  clears the buffer with zeros, and returns a pointer to the allocated buffer.\r
+  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is\r
   not enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
   @param  PoolType              The type of memory to allocate.\r
@@ -687,9 +687,9 @@ AllocateReservedPool (
 **/\r
 VOID *\r
 InternalAllocateZeroPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN EFI_MEMORY_TYPE  PoolType,\r
   IN UINTN            AllocationSize\r
-  ) \r
+  )\r
 {\r
   VOID  *Memory;\r
 \r
@@ -703,9 +703,9 @@ InternalAllocateZeroPool (
 /**\r
   Allocates and zeros a buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, \r
-  clears the buffer with zeros, and returns a pointer to the allocated buffer.  \r
-  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,\r
+  clears the buffer with zeros, and returns a pointer to the allocated buffer.\r
+  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is\r
   not enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
@@ -738,9 +738,9 @@ AllocateZeroPool (
 /**\r
   Allocates and zeros a buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, \r
-  clears the buffer with zeros, and returns a pointer to the allocated buffer.  \r
-  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,\r
+  clears the buffer with zeros, and returns a pointer to the allocated buffer.\r
+  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is\r
   not enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
@@ -773,9 +773,9 @@ AllocateRuntimeZeroPool (
 /**\r
   Allocates and zeros a buffer of type EfiReservedMemoryType.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, \r
-  clears the   buffer with zeros, and returns a pointer to the allocated buffer.  \r
-  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is \r
+  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType,\r
+  clears the   buffer with zeros, and returns a pointer to the allocated buffer.\r
+  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is\r
   not enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
@@ -795,12 +795,12 @@ AllocateReservedZeroPool (
 /**\r
   Copies a buffer to an allocated buffer of a certain pool type.\r
 \r
-  Allocates the number bytes specified by AllocationSize of a certain pool type, \r
-  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns \r
-  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer \r
-  of 0 size is returned.  If there is not enough memory remaining to satisfy the \r
+  Allocates the number bytes specified by AllocationSize of a certain pool type,\r
+  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns\r
+  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer\r
+  of 0 size is returned.  If there is not enough memory remaining to satisfy the\r
   request, then NULL is returned. If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  PoolType              The type of pool to allocate.\r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
@@ -811,10 +811,10 @@ AllocateReservedZeroPool (
 **/\r
 VOID *\r
 InternalAllocateCopyPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN EFI_MEMORY_TYPE  PoolType,\r
   IN UINTN            AllocationSize,\r
   IN CONST VOID       *Buffer\r
-  ) \r
+  )\r
 {\r
   VOID  *Memory;\r
 \r
@@ -826,19 +826,19 @@ InternalAllocateCopyPool (
      Memory = CopyMem (Memory, Buffer, AllocationSize);\r
   }\r
   return Memory;\r
-} \r
+}\r
 \r
 /**\r
   Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, \r
-  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns \r
-  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer \r
-  of 0 size is returned.  If there is not enough memory remaining to satisfy the \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,\r
+  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns\r
+  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer\r
+  of 0 size is returned.  If there is not enough memory remaining to satisfy the\r
   request, then NULL is returned.\r
-  \r
+\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
@@ -872,14 +872,14 @@ AllocateCopyPool (
 /**\r
   Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, \r
-  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns \r
-  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer \r
-  of 0 size is returned.  If there is not enough memory remaining to satisfy the \r
+  Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,\r
+  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns\r
+  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer\r
+  of 0 size is returned.  If there is not enough memory remaining to satisfy the\r
   request, then NULL is returned.\r
-  \r
+\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
@@ -913,14 +913,14 @@ AllocateRuntimeCopyPool (
 /**\r
   Copies a buffer to an allocated buffer of type EfiReservedMemoryType.\r
 \r
-  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, \r
-  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns \r
-  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer \r
-  of 0 size is returned.  If there is not enough memory remaining to satisfy the \r
+  Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType,\r
+  copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns\r
+  a pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer\r
+  of 0 size is returned.  If there is not enough memory remaining to satisfy the\r
   request, then NULL is returned.\r
-  \r
+\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
@@ -942,19 +942,19 @@ AllocateReservedCopyPool (
   Reallocates a buffer of a specified memory type.\r
 \r
   Allocates and zeros the number bytes specified by NewSize from memory of the type\r
-  specified by PoolType.  If OldBuffer is not NULL, then the smaller of OldSize and \r
-  NewSize bytes are copied from OldBuffer to the newly allocated buffer, and \r
-  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.  \r
-  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
+  specified by PoolType.  If OldBuffer is not NULL, then the smaller of OldSize and\r
+  NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r
+  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.\r
+  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not\r
   enough memory remaining to satisfy the request, then NULL is returned.\r
-  \r
-  If the allocation of the new buffer is successful and the smaller of NewSize \r
+\r
+  If the allocation of the new buffer is successful and the smaller of NewSize\r
   and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  PoolType       The type of pool to allocate.\r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
-  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an \r
+  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an\r
                          optional parameter that may be NULL.\r
 \r
   @return A pointer to the allocated buffer or NULL if allocation fails.\r
@@ -962,7 +962,7 @@ AllocateReservedCopyPool (
 **/\r
 VOID *\r
 InternalReallocatePool (\r
-  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN EFI_MEMORY_TYPE  PoolType,\r
   IN UINTN            OldSize,\r
   IN UINTN            NewSize,\r
   IN VOID             *OldBuffer  OPTIONAL\r
@@ -982,18 +982,18 @@ InternalReallocatePool (
   Reallocates a buffer of type EfiRuntimeServicesData.\r
 \r
   Allocates and zeros the number bytes specified by NewSize from memory of type\r
-  EfiRuntimeServicesData.  If OldBuffer is not NULL, then the smaller of OldSize and \r
-  NewSize bytes are copied from OldBuffer to the newly allocated buffer, and \r
-  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.  \r
-  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
+  EfiRuntimeServicesData.  If OldBuffer is not NULL, then the smaller of OldSize and\r
+  NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r
+  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.\r
+  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not\r
   enough memory remaining to satisfy the request, then NULL is returned.\r
-  \r
-  If the allocation of the new buffer is successful and the smaller of NewSize \r
+\r
+  If the allocation of the new buffer is successful and the smaller of NewSize\r
   and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
-  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an \r
+  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an\r
                          optional parameter that may be NULL.\r
 \r
   @return A pointer to the allocated buffer or NULL if allocation fails.\r
@@ -1027,18 +1027,18 @@ ReallocatePool (
   Reallocates a buffer of type EfiRuntimeServicesData.\r
 \r
   Allocates and zeros the number bytes specified by NewSize from memory of type\r
-  EfiRuntimeServicesData.  If OldBuffer is not NULL, then the smaller of OldSize \r
-  and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and \r
-  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.  \r
-  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
+  EfiRuntimeServicesData.  If OldBuffer is not NULL, then the smaller of OldSize\r
+  and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r
+  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.\r
+  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not\r
   enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
-  If the allocation of the new buffer is successful and the smaller of NewSize \r
+  If the allocation of the new buffer is successful and the smaller of NewSize\r
   and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
-  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an \r
+  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an\r
                          optional parameter that may be NULL.\r
 \r
   @return A pointer to the allocated buffer or NULL if allocation fails.\r
@@ -1072,18 +1072,18 @@ ReallocateRuntimePool (
   Reallocates a buffer of type EfiReservedMemoryType.\r
 \r
   Allocates and zeros the number bytes specified by NewSize from memory of type\r
-  EfiReservedMemoryType.  If OldBuffer is not NULL, then the smaller of OldSize \r
-  and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and \r
-  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.  \r
-  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
+  EfiReservedMemoryType.  If OldBuffer is not NULL, then the smaller of OldSize\r
+  and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r
+  OldBuffer is freed.  A pointer to the newly allocated buffer is returned.\r
+  If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not\r
   enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
-  If the allocation of the new buffer is successful and the smaller of NewSize \r
+  If the allocation of the new buffer is successful and the smaller of NewSize\r
   and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
-  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an \r
+  @param  OldBuffer      The buffer to copy to the allocated buffer.  This is an\r
                          optional parameter that may be NULL.\r
 \r
   @return A pointer to the allocated buffer or NULL if allocation fails.\r
@@ -1101,15 +1101,15 @@ ReallocateReservedPool (
 }\r
 \r
 /**\r
-  Frees a buffer that was previously allocated with one of the pool allocation \r
+  Frees a buffer that was previously allocated with one of the pool allocation\r
   functions in the Memory Allocation Library.\r
 \r
-  Frees the buffer specified by Buffer.  Buffer must have been allocated on a \r
-  previous call to the pool allocation services of the Memory Allocation Library.  \r
-  If it is not possible to free pool resources, then this function will perform \r
+  Frees the buffer specified by Buffer.  Buffer must have been allocated on a\r
+  previous call to the pool allocation services of the Memory Allocation Library.\r
+  If it is not possible to free pool resources, then this function will perform\r
   no actions.\r
-  \r
-  If Buffer was not allocated with a pool allocation function in the Memory \r
+\r
+  If Buffer was not allocated with a pool allocation function in the Memory\r
   Allocation Library, then ASSERT().\r
 \r
   @param  Buffer                The pointer to the buffer to free.\r