\r
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
\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
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include <PiPei.h>\r
\r
#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
#include <Library/PrePiLib.h>\r
#include <Library/DebugLib.h>\r
\r
}\r
}\r
\r
+/**\r
+ Allocates and zeros a buffer of type EfiBootServicesData.\r
+\r
+ Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the\r
+ buffer with zeros, 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 satisfy the\r
+ request, then NULL is returned.\r
+\r
+ @param AllocationSize The number of bytes to allocate and zero.\r
+\r
+ @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+AllocateZeroPool (\r
+ IN UINTN AllocationSize\r
+ )\r
+{\r
+ VOID *Buffer;\r
+\r
+ Buffer = AllocatePool (AllocationSize);\r
+ if (Buffer == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ ZeroMem (Buffer, AllocationSize);\r
+\r
+ return Buffer;\r
+}\r
+\r
/**\r
Frees a buffer that was previously allocated with one of the pool allocation functions in the\r
Memory Allocation Library.\r