]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/UefiLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
index f80067f1110372127cb19a9c8b6bf05d52383a87..be7da7fdf7dac177fad096b01ac13de07b5ac1ed 100644 (file)
   of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is\r
   defined, then debug and assert related macros wrapped by it are the NULL implementations.\r
 \r
+Copyright (c) 2019, NVIDIA Corporation. All rights reserved.\r
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under\r
-the terms and conditions of the BSD License that accompanies this distribution.\r
-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
 #ifndef __UEFI_LIB_H__\r
 #define __UEFI_LIB_H__\r
 \r
+#include <IndustryStandard/Acpi.h>\r
+\r
 #include <Protocol/DriverBinding.h>\r
 #include <Protocol/DriverConfiguration.h>\r
 #include <Protocol/ComponentName.h>\r
@@ -42,8 +39,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /// Unicode String Table\r
 ///\r
 typedef struct {\r
-  CHAR8   *Language;\r
-  CHAR16  *UnicodeString;\r
+  CHAR8     *Language;\r
+  CHAR16    *UnicodeString;\r
 } EFI_UNICODE_STRING_TABLE;\r
 \r
 ///\r
@@ -59,9 +56,9 @@ typedef enum {
 /// EFI Lock\r
 ///\r
 typedef struct {\r
-  EFI_TPL         Tpl;\r
-  EFI_TPL         OwnerTpl;\r
-  EFI_LOCK_STATE  Lock;\r
+  EFI_TPL           Tpl;\r
+  EFI_TPL           OwnerTpl;\r
+  EFI_LOCK_STATE    Lock;\r
 } EFI_LOCK;\r
 \r
 /**\r
@@ -74,7 +71,7 @@ typedef struct {
           by Microseconds.\r
 \r
 **/\r
-#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)\r
+#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds)  MultU64x32((UINT64)(Microseconds), 10)\r
 \r
 /**\r
   Macro that returns the number of 100 ns units for a specified number of milliseconds.\r
@@ -86,7 +83,7 @@ typedef struct {
           by Milliseconds.\r
 \r
 **/\r
-#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)\r
+#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds)  MultU64x32((UINT64)(Milliseconds), 10000)\r
 \r
 /**\r
   Macro that returns the number of 100 ns units for a specified number of seconds.\r
@@ -98,7 +95,7 @@ typedef struct {
           by Seconds.\r
 \r
 **/\r
-#define EFI_TIMER_PERIOD_SECONDS(Seconds)           MultU64x32((UINT64)(Seconds), 10000000)\r
+#define EFI_TIMER_PERIOD_SECONDS(Seconds)  MultU64x32((UINT64)(Seconds), 10000000)\r
 \r
 /**\r
   Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array\r
@@ -168,11 +165,11 @@ EfiGetSystemConfigurationTable (
 **/\r
 EFI_EVENT\r
 EFIAPI\r
-EfiCreateProtocolNotifyEvent(\r
+EfiCreateProtocolNotifyEvent (\r
   IN  EFI_GUID          *ProtocolGuid,\r
   IN  EFI_TPL           NotifyTpl,\r
   IN  EFI_EVENT_NOTIFY  NotifyFunction,\r
-  IN  VOID              *NotifyContext,  OPTIONAL\r
+  IN  VOID              *NotifyContext   OPTIONAL,\r
   OUT VOID              **Registration\r
   );\r
 \r
@@ -202,7 +199,7 @@ EfiNamedEventListen (
   IN CONST EFI_GUID    *Name,\r
   IN EFI_TPL           NotifyTpl,\r
   IN EFI_EVENT_NOTIFY  NotifyFunction,\r
-  IN CONST VOID        *NotifyContext,  OPTIONAL\r
+  IN CONST VOID        *NotifyContext   OPTIONAL,\r
   OUT VOID             *Registration OPTIONAL\r
   );\r
 \r
@@ -240,7 +237,7 @@ EfiNamedEventSignal (
 EFI_STATUS\r
 EFIAPI\r
 EfiEventGroupSignal (\r
-  IN CONST EFI_GUID *EventGroup\r
+  IN CONST EFI_GUID  *EventGroup\r
   );\r
 \r
 /**\r
@@ -255,8 +252,8 @@ EfiEventGroupSignal (
 VOID\r
 EFIAPI\r
 EfiEventEmptyFunction (\r
-  IN EFI_EVENT              Event,\r
-  IN VOID                   *Context\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
   );\r
 \r
 /**\r
@@ -297,7 +294,7 @@ EFI_LOCK *
 EFIAPI\r
 EfiInitializeLock (\r
   IN OUT EFI_LOCK  *Lock,\r
-  IN EFI_TPL        Priority\r
+  IN EFI_TPL       Priority\r
   );\r
 \r
 /**\r
@@ -316,7 +313,6 @@ EfiInitializeLock (
 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r
   {Priority, TPL_APPLICATION, EfiLockReleased }\r
 \r
-\r
 /**\r
   Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.\r
 \r
@@ -331,8 +327,8 @@ EfiInitializeLock (
   @param  LockParameter  A pointer to the lock to acquire.\r
 \r
 **/\r
-#if !defined(MDEPKG_NDEBUG)\r
-  #define ASSERT_LOCKED(LockParameter)                  \\r
+#if !defined (MDEPKG_NDEBUG)\r
+#define ASSERT_LOCKED(LockParameter)                  \\r
     do {                                                \\r
       if (DebugAssertEnabled ()) {                      \\r
         ASSERT (LockParameter != NULL);                 \\r
@@ -342,10 +338,9 @@ EfiInitializeLock (
       }                                                 \\r
     } while (FALSE)\r
 #else\r
-  #define ASSERT_LOCKED(LockParameter)\r
+#define ASSERT_LOCKED(LockParameter)\r
 #endif\r
 \r
-\r
 /**\r
   Acquires ownership of a lock.\r
 \r
@@ -432,9 +427,9 @@ EfiReleaseLock (
 EFI_STATUS\r
 EFIAPI\r
 EfiTestManagedDevice (\r
-  IN CONST EFI_HANDLE       ControllerHandle,\r
-  IN CONST EFI_HANDLE       DriverBindingHandle,\r
-  IN CONST EFI_GUID         *ProtocolGuid\r
+  IN CONST EFI_HANDLE  ControllerHandle,\r
+  IN CONST EFI_HANDLE  DriverBindingHandle,\r
+  IN CONST EFI_GUID    *ProtocolGuid\r
   );\r
 \r
 /**\r
@@ -459,9 +454,27 @@ EfiTestManagedDevice (
 EFI_STATUS\r
 EFIAPI\r
 EfiTestChildHandle (\r
-  IN CONST EFI_HANDLE       ControllerHandle,\r
-  IN CONST EFI_HANDLE       ChildHandle,\r
-  IN CONST EFI_GUID         *ProtocolGuid\r
+  IN CONST EFI_HANDLE  ControllerHandle,\r
+  IN CONST EFI_HANDLE  ChildHandle,\r
+  IN CONST EFI_GUID    *ProtocolGuid\r
+  );\r
+\r
+/**\r
+  This function checks the supported languages list for a target language,\r
+  This only supports RFC 4646 Languages.\r
+\r
+  @param  SupportedLanguages  The supported languages\r
+  @param  TargetLanguage      The target language\r
+\r
+  @retval Returns EFI_SUCCESS if the language is supported,\r
+          EFI_UNSUPPORTED otherwise\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+IsLanguageSupported (\r
+  IN CONST CHAR8  *SupportedLanguages,\r
+  IN CONST CHAR8  *TargetLanguage\r
   );\r
 \r
 /**\r
@@ -665,65 +678,69 @@ FreeUnicodeStringTable (
   IN EFI_UNICODE_STRING_TABLE  *UnicodeStringTable\r
   );\r
 \r
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
-\r
 /**\r
-  [ATTENTION] This function will be deprecated for security reason.\r
-\r
-  Returns a pointer to an allocated buffer that contains the contents of a\r
-  variable retrieved through the UEFI Runtime Service GetVariable().  The\r
+  Returns the status whether get the variable success. The function retrieves\r
+  variable  through the UEFI Runtime Service GetVariable().  The\r
   returned buffer is allocated using AllocatePool().  The caller is responsible\r
   for freeing this buffer with FreePool().\r
 \r
-  If Name is NULL, then ASSERT().\r
-  If Guid is NULL, then ASSERT().\r
+  If Name  is NULL, then ASSERT().\r
+  If Guid  is NULL, then ASSERT().\r
+  If Value is NULL, then ASSERT().\r
 \r
   @param[in]  Name  The pointer to a Null-terminated Unicode string.\r
-  @param[in]  Guid  The pointer to an EFI_GUID structure.\r
+  @param[in]  Guid  The pointer to an EFI_GUID structure\r
+  @param[out] Value The buffer point saved the variable info.\r
+  @param[out] Size  The buffer size of the variable.\r
 \r
-  @retval NULL   The variable could not be retrieved.\r
-  @retval NULL   There are not enough resources available for the variable contents.\r
-  @retval Other  A pointer to allocated buffer containing the variable contents.\r
+  @retval EFI_OUT_OF_RESOURCES      Allocate buffer failed.\r
+  @retval EFI_SUCCESS               Find the specified variable.\r
+  @retval Others Errors             Return errors from call to gRT->GetVariable.\r
 \r
 **/\r
-VOID *\r
+EFI_STATUS\r
 EFIAPI\r
-GetVariable (\r
+GetVariable2 (\r
   IN CONST CHAR16    *Name,\r
-  IN CONST EFI_GUID  *Guid\r
+  IN CONST EFI_GUID  *Guid,\r
+  OUT VOID           **Value,\r
+  OUT UINTN          *Size OPTIONAL\r
   );\r
 \r
 /**\r
-  [ATTENTION] This function will be deprecated for security reason.\r
-\r
   Returns a pointer to an allocated buffer that contains the contents of a\r
   variable retrieved through the UEFI Runtime Service GetVariable().  This\r
   function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
   The returned buffer is allocated using AllocatePool().  The caller is\r
   responsible for freeing this buffer with FreePool().\r
 \r
-  If Name is NULL, then ASSERT().\r
+  If Name  is NULL, then ASSERT().\r
+  If Value is NULL, then ASSERT().\r
 \r
   @param[in]  Name  The pointer to a Null-terminated Unicode string.\r
+  @param[out] Value The buffer point saved the variable info.\r
+  @param[out] Size  The buffer size of the variable.\r
 \r
-  @retval NULL   The variable could not be retrieved.\r
-  @retval NULL   There are not enough resources available for the variable contents.\r
-  @retval Other  A pointer to allocated buffer containing the variable contents.\r
+  @retval EFI_OUT_OF_RESOURCES      Allocate buffer failed.\r
+  @retval EFI_SUCCESS               Find the specified variable.\r
+  @retval Others Errors             Return errors from call to gRT->GetVariable.\r
 \r
 **/\r
-VOID *\r
+EFI_STATUS\r
 EFIAPI\r
-GetEfiGlobalVariable (\r
-  IN CONST CHAR16  *Name\r
+GetEfiGlobalVariable2 (\r
+  IN CONST CHAR16  *Name,\r
+  OUT VOID         **Value,\r
+  OUT UINTN        *Size OPTIONAL\r
   );\r
-#endif\r
 \r
+/** Return the attributes of the variable.\r
 \r
-/**\r
   Returns the status whether get the variable success. The function retrieves\r
   variable  through the UEFI Runtime Service GetVariable().  The\r
   returned buffer is allocated using AllocatePool().  The caller is responsible\r
-  for freeing this buffer with FreePool().\r
+  for freeing this buffer with FreePool().  The attributes are returned if\r
+  the caller provides a valid Attribute parameter.\r
 \r
   If Name  is NULL, then ASSERT().\r
   If Guid  is NULL, then ASSERT().\r
@@ -733,46 +750,21 @@ GetEfiGlobalVariable (
   @param[in]  Guid  The pointer to an EFI_GUID structure\r
   @param[out] Value The buffer point saved the variable info.\r
   @param[out] Size  The buffer size of the variable.\r
+  @param[out] Attr  The pointer to the variable attributes as found in var store\r
 \r
-  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.\r
-  @return EFI_SUCCESS               Find the specified variable.\r
-  @return Others Errors             Return errors from call to gRT->GetVariable.\r
+  @retval EFI_OUT_OF_RESOURCES      Allocate buffer failed.\r
+  @retval EFI_SUCCESS               Find the specified variable.\r
+  @retval Others Errors             Return errors from call to gRT->GetVariable.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-GetVariable2 (\r
+GetVariable3 (\r
   IN CONST CHAR16    *Name,\r
   IN CONST EFI_GUID  *Guid,\r
   OUT VOID           **Value,\r
-  OUT UINTN          *Size OPTIONAL\r
-  );\r
-\r
-/**\r
-  Returns a pointer to an allocated buffer that contains the contents of a\r
-  variable retrieved through the UEFI Runtime Service GetVariable().  This\r
-  function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
-  The returned buffer is allocated using AllocatePool().  The caller is\r
-  responsible for freeing this buffer with FreePool().\r
-\r
-  If Name  is NULL, then ASSERT().\r
-  If Value is NULL, then ASSERT().\r
-\r
-  @param[in]  Name  The pointer to a Null-terminated Unicode string.\r
-  @param[out] Value The buffer point saved the variable info.\r
-  @param[out] Size  The buffer size of the variable.\r
-\r
-  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.\r
-  @return EFI_SUCCESS               Find the specified variable.\r
-  @return Others Errors             Return errors from call to gRT->GetVariable.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetEfiGlobalVariable2 (\r
-  IN CONST CHAR16    *Name,\r
-  OUT VOID           **Value,\r
-  OUT UINTN          *Size OPTIONAL\r
+  OUT UINTN          *Size OPTIONAL,\r
+  OUT UINT32         *Attr OPTIONAL\r
   );\r
 \r
 /**\r
@@ -846,7 +838,7 @@ VOID
 EFIAPI\r
 CreatePopUp (\r
   IN  UINTN          Attribute,\r
-  OUT EFI_INPUT_KEY  *Key,      OPTIONAL\r
+  OUT EFI_INPUT_KEY  *Key       OPTIONAL,\r
   ...\r
   );\r
 \r
@@ -894,6 +886,7 @@ UnicodeStringDisplayLength (
 //\r
 // Functions that abstract early Framework contamination of UEFI.\r
 //\r
+\r
 /**\r
   Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
 \r
@@ -970,8 +963,8 @@ EFI_STATUS
 EFIAPI\r
 EfiCreateEventLegacyBootEx (\r
   IN  EFI_TPL           NotifyTpl,\r
-  IN  EFI_EVENT_NOTIFY  NotifyFunction,  OPTIONAL\r
-  IN  VOID              *NotifyContext,  OPTIONAL\r
+  IN  EFI_EVENT_NOTIFY  NotifyFunction   OPTIONAL,\r
+  IN  VOID              *NotifyContext   OPTIONAL,\r
   OUT EFI_EVENT         *LegacyBootEvent\r
   );\r
 \r
@@ -1021,8 +1014,8 @@ EFI_STATUS
 EFIAPI\r
 EfiCreateEventReadyToBootEx (\r
   IN  EFI_TPL           NotifyTpl,\r
-  IN  EFI_EVENT_NOTIFY  NotifyFunction,  OPTIONAL\r
-  IN  VOID              *NotifyContext,  OPTIONAL\r
+  IN  EFI_EVENT_NOTIFY  NotifyFunction   OPTIONAL,\r
+  IN  VOID              *NotifyContext   OPTIONAL,\r
   OUT EFI_EVENT         *ReadyToBootEvent\r
   );\r
 \r
@@ -1179,7 +1172,6 @@ AsciiErrorPrint (
   ...\r
   );\r
 \r
-\r
 /**\r
   Prints a formatted Unicode string to a graphics console device specified by\r
   ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
@@ -1223,11 +1215,11 @@ AsciiErrorPrint (
 UINTN\r
 EFIAPI\r
 PrintXY (\r
-  IN UINTN                            PointX,\r
-  IN UINTN                            PointY,\r
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *ForeGround, OPTIONAL\r
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *BackGround, OPTIONAL\r
-  IN CONST CHAR16                     *Format,\r
+  IN UINTN                          PointX,\r
+  IN UINTN                          PointY,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *ForeGround  OPTIONAL,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BackGround  OPTIONAL,\r
+  IN CONST CHAR16                   *Format,\r
   ...\r
   );\r
 \r
@@ -1273,11 +1265,11 @@ PrintXY (
 UINTN\r
 EFIAPI\r
 AsciiPrintXY (\r
-  IN UINTN                            PointX,\r
-  IN UINTN                            PointY,\r
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *ForeGround, OPTIONAL\r
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *BackGround, OPTIONAL\r
-  IN CONST CHAR8                      *Format,\r
+  IN UINTN                          PointX,\r
+  IN UINTN                          PointY,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *ForeGround  OPTIONAL,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BackGround  OPTIONAL,\r
+  IN CONST CHAR8                    *Format,\r
   ...\r
   );\r
 \r
@@ -1312,6 +1304,23 @@ EfiLibInstallDriverBinding (
   IN EFI_HANDLE                   DriverBindingHandle\r
   );\r
 \r
+/**\r
+  Uninstalls a Driver Binding Protocol instance.\r
+\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If DriverBinding can not be uninstalled, then ASSERT().\r
+\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.\r
+\r
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.\r
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibUninstallDriverBinding (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *DriverBinding\r
+  );\r
 \r
 /**\r
   Installs and completes the initialization of a Driver Binding Protocol instance and\r
@@ -1346,12 +1355,35 @@ EfiLibInstallAllDriverProtocols (
   IN CONST EFI_SYSTEM_TABLE                   *SystemTable,\r
   IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,\r
   IN EFI_HANDLE                               DriverBindingHandle,\r
-  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL\r
-  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration, OPTIONAL\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName        OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration  OPTIONAL,\r
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL\r
   );\r
 \r
+/**\r
+  Uninstalls a Driver Binding Protocol instance and optionally uninstalls the\r
+  Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
+\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the uninstallation fails, then ASSERT().\r
+\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.\r
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.\r
+  @param  DriverConfiguration  A Driver Configuration Protocol instance that this driver produced.\r
+  @param  DriverDiagnostics    A Driver Diagnostics Protocol instance that this driver produced.\r
 \r
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.\r
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibUninstallAllDriverProtocols (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName        OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration  OPTIONAL,\r
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics    OPTIONAL\r
+  );\r
 \r
 /**\r
   Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
@@ -1379,14 +1411,35 @@ EfiLibInstallAllDriverProtocols (
 EFI_STATUS\r
 EFIAPI\r
 EfiLibInstallDriverBindingComponentName2 (\r
-  IN CONST EFI_HANDLE                         ImageHandle,\r
-  IN CONST EFI_SYSTEM_TABLE                   *SystemTable,\r
-  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,\r
-  IN EFI_HANDLE                               DriverBindingHandle,\r
-  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,       OPTIONAL\r
-  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2       OPTIONAL\r
+  IN CONST EFI_HANDLE                    ImageHandle,\r
+  IN CONST EFI_SYSTEM_TABLE              *SystemTable,\r
+  IN EFI_DRIVER_BINDING_PROTOCOL         *DriverBinding,\r
+  IN EFI_HANDLE                          DriverBindingHandle,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL   *ComponentName        OPTIONAL,\r
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL  *ComponentName2       OPTIONAL\r
   );\r
 \r
+/**\r
+  Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
+\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the uninstallation fails, then ASSERT().\r
+\r
+  @param  DriverBinding        A Driver Binding Protocol instance that this driver produced.\r
+  @param  ComponentName        A Component Name Protocol instance that this driver produced.\r
+  @param  ComponentName2       A Component Name 2 Protocol instance that this driver produced.\r
+\r
+  @retval EFI_SUCCESS           The protocol installation successfully completed.\r
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibUninstallDriverBindingComponentName2 (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL         *DriverBinding,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL   *ComponentName        OPTIONAL,\r
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL  *ComponentName2       OPTIONAL\r
+  );\r
 \r
 /**\r
   Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
@@ -1420,16 +1473,48 @@ EfiLibInstallDriverBindingComponentName2 (
 EFI_STATUS\r
 EFIAPI\r
 EfiLibInstallAllDriverProtocols2 (\r
-  IN CONST EFI_HANDLE                         ImageHandle,\r
-  IN CONST EFI_SYSTEM_TABLE                   *SystemTable,\r
-  IN EFI_DRIVER_BINDING_PROTOCOL              *DriverBinding,\r
-  IN EFI_HANDLE                               DriverBindingHandle,\r
-  IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,        OPTIONAL\r
-  IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,       OPTIONAL\r
-  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL\r
-  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
-  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,    OPTIONAL\r
-  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL\r
+  IN CONST EFI_HANDLE                          ImageHandle,\r
+  IN CONST EFI_SYSTEM_TABLE                    *SystemTable,\r
+  IN EFI_DRIVER_BINDING_PROTOCOL               *DriverBinding,\r
+  IN EFI_HANDLE                                DriverBindingHandle,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL         *ComponentName         OPTIONAL,\r
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL        *ComponentName2        OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL   *DriverConfiguration   OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL  *DriverConfiguration2  OPTIONAL,\r
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL     *DriverDiagnostics     OPTIONAL,\r
+  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL    *DriverDiagnostics2    OPTIONAL\r
+  );\r
+\r
+/**\r
+  Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
+  Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
+\r
+  If DriverBinding is NULL, then ASSERT().\r
+  If the installation fails, then ASSERT().\r
+\r
+\r
+  @param  DriverBinding         A Driver Binding Protocol instance that this driver produced.\r
+  @param  ComponentName         A Component Name Protocol instance that this driver produced.\r
+  @param  ComponentName2        A Component Name 2 Protocol instance that this driver produced.\r
+  @param  DriverConfiguration   A Driver Configuration Protocol instance that this driver produced.\r
+  @param  DriverConfiguration2  A Driver Configuration Protocol 2 instance that this driver produced.\r
+  @param  DriverDiagnostics     A Driver Diagnostics Protocol instance that this driver produced.\r
+  @param  DriverDiagnostics2    A Driver Diagnostics Protocol 2 instance that this driver produced.\r
+\r
+  @retval EFI_SUCCESS           The protocol uninstallation successfully completed.\r
+  @retval Others                Status from gBS->UninstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibUninstallAllDriverProtocols2 (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL               *DriverBinding,\r
+  IN CONST EFI_COMPONENT_NAME_PROTOCOL         *ComponentName         OPTIONAL,\r
+  IN CONST EFI_COMPONENT_NAME2_PROTOCOL        *ComponentName2        OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL   *DriverConfiguration   OPTIONAL,\r
+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL  *DriverConfiguration2  OPTIONAL,\r
+  IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL     *DriverDiagnostics     OPTIONAL,\r
+  IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL    *DriverDiagnostics2    OPTIONAL\r
   );\r
 \r
 /**\r
@@ -1453,10 +1538,10 @@ EfiLibInstallAllDriverProtocols2 (
   @return         Null-terminated Unicode string is that is the formatted\r
                   string appended to String.\r
 **/\r
-CHAR16*\r
+CHAR16 *\r
 EFIAPI\r
 CatVSPrint (\r
-  IN  CHAR16  *String, OPTIONAL\r
+  IN  CHAR16        *String  OPTIONAL,\r
   IN  CONST CHAR16  *FormatString,\r
   IN  VA_LIST       Marker\r
   );\r
@@ -1487,7 +1572,7 @@ CatVSPrint (
 CHAR16 *\r
 EFIAPI\r
 CatSPrint (\r
-  IN  CHAR16  *String, OPTIONAL\r
+  IN  CHAR16        *String  OPTIONAL,\r
   IN  CONST CHAR16  *FormatString,\r
   ...\r
   );\r
@@ -1595,4 +1680,70 @@ EfiOpenFileByDevicePath (
   IN     UINT64                    OpenMode,\r
   IN     UINT64                    Attributes\r
   );\r
+\r
+/**\r
+  This function locates next ACPI table in XSDT/RSDT based on Signature and\r
+  previous returned Table.\r
+\r
+  If PreviousTable is NULL:\r
+  This function will locate the first ACPI table in XSDT/RSDT based on\r
+  Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
+  gEfiAcpi10TableGuid system configuration table.\r
+  This function will locate in XSDT first, and then RSDT.\r
+  For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
+  FADT.\r
+  For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
+  FirmwareCtrl in FADT.\r
+\r
+  If PreviousTable is not NULL:\r
+  1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration\r
+     table, then this function will just locate next table in XSDT in\r
+     gEfiAcpi20TableGuid system configuration table.\r
+  2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration\r
+     table, then this function will just locate next table in RSDT in\r
+     gEfiAcpi20TableGuid system configuration table.\r
+  3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration\r
+     table, then this function will just locate next table in RSDT in\r
+     gEfiAcpi10TableGuid system configuration table.\r
+\r
+  It's not supported that PreviousTable is not NULL but PreviousTable->Signature\r
+  is not same with Signature, NULL will be returned.\r
+\r
+  @param Signature          ACPI table signature.\r
+  @param PreviousTable      Pointer to previous returned table to locate next\r
+                            table, or NULL to locate first table.\r
+\r
+  @return Next ACPI table or NULL if not found.\r
+\r
+**/\r
+EFI_ACPI_COMMON_HEADER *\r
+EFIAPI\r
+EfiLocateNextAcpiTable (\r
+  IN UINT32                  Signature,\r
+  IN EFI_ACPI_COMMON_HEADER  *PreviousTable OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function locates first ACPI table in XSDT/RSDT based on Signature.\r
+\r
+  This function will locate the first ACPI table in XSDT/RSDT based on\r
+  Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
+  gEfiAcpi10TableGuid system configuration table.\r
+  This function will locate in XSDT first, and then RSDT.\r
+  For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
+  FADT.\r
+  For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
+  FirmwareCtrl in FADT.\r
+\r
+  @param Signature          ACPI table signature.\r
+\r
+  @return First ACPI table or NULL if not found.\r
+\r
+**/\r
+EFI_ACPI_COMMON_HEADER *\r
+EFIAPI\r
+EfiLocateFirstAcpiTable (\r
+  IN UINT32  Signature\r
+  );\r
+\r
 #endif\r