]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
IntelFrameworkModulePkg BdsDxe: Remove redundant functions
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / BmLib.c
index 5fe5388f9e5add1f31b45f2517a129da23034718..a7ff449557ef0ae4eeb6b57acb466341f525f06b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Utility routines used by boot maintenance modules.\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 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
@@ -146,7 +146,7 @@ EfiLibGetVariable (
 \r
   @param VarName           A Null-terminated Unicode string that is\r
                            the name of the vendor's variable.\r
-                         \r
+\r
   @param VarGuid           A unique identifier for the vendor.\r
 \r
   @retval  EFI_SUCCESS           The variable was found and removed\r
@@ -323,45 +323,9 @@ EfiDevicePathInstanceCount (
   return Count;\r
 }\r
 \r
-/**\r
-  Adjusts the size of a previously allocated buffer.\r
-\r
-\r
-  @param OldPool         - A pointer to the buffer whose size is being adjusted.\r
-  @param OldSize         - The size of the current buffer.\r
-  @param NewSize         - The size of the new buffer.\r
-\r
-  @return   The newly allocated buffer.\r
-  @retval   NULL  Allocation failed.\r
-\r
-**/\r
-VOID *\r
-EfiReallocatePool (\r
-  IN VOID                 *OldPool,\r
-  IN UINTN                OldSize,\r
-  IN UINTN                NewSize\r
-  )\r
-{\r
-  VOID  *NewPool;\r
-\r
-  NewPool = NULL;\r
-  if (NewSize != 0) {\r
-    NewPool = AllocateZeroPool (NewSize);\r
-  }\r
-\r
-  if (OldPool != NULL) {\r
-    if (NewPool != NULL) {\r
-      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);\r
-    }\r
-\r
-    FreePool (OldPool);\r
-  }\r
-\r
-  return NewPool;\r
-}\r
 \r
 /**\r
-  Get a string from the Data Hub record based on \r
+  Get a string from the Data Hub record based on\r
   a device path.\r
 \r
   @param DevPath         The device Path.\r
@@ -378,3 +342,34 @@ EfiLibStrFromDatahub (
 {\r
   return NULL;\r
 }\r
+\r
+/**\r
+\r
+  Find the first instance of this Protocol\r
+  in the system and return it's interface.\r
+\r
+\r
+  @param ProtocolGuid    Provides the protocol to search for\r
+  @param Interface       On return, a pointer to the first interface\r
+                         that matches ProtocolGuid\r
+\r
+  @retval  EFI_SUCCESS      A protocol instance matching ProtocolGuid was found\r
+  @retval  EFI_NOT_FOUND    No protocol instances were found that match ProtocolGuid\r
+\r
+**/\r
+EFI_STATUS\r
+EfiLibLocateProtocol (\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  OUT VOID        **Interface\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = gBS->LocateProtocol (\r
+                  ProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) Interface\r
+                  );\r
+  return Status;\r
+}\r
+\r