]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/UefiLib.h
MdePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
index 468bffc3cb6660ef9a4f52fc2a54aed671142352..f56ffde1230e72444d7172166eb99ab568d9be94 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
@@ -466,6 +461,24 @@ EfiTestChildHandle (
   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
   This function looks up a Unicode string in UnicodeStringTable.\r
 \r
@@ -667,59 +680,6 @@ 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
-  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
-\r
-  @param[in]  Name  The pointer to a Null-terminated Unicode string.\r
-  @param[in]  Guid  The pointer to an EFI_GUID structure.\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
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-GetVariable (\r
-  IN CONST CHAR16    *Name,\r
-  IN CONST EFI_GUID  *Guid\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
-\r
-  @param[in]  Name  The pointer to a Null-terminated Unicode string.\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
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-GetEfiGlobalVariable (\r
-  IN CONST CHAR16  *Name\r
-  );\r
-#endif\r
-\r
 \r
 /**\r
   Returns the status whether get the variable success. The function retrieves\r
@@ -736,9 +696,9 @@ GetEfiGlobalVariable (
   @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
+  @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
@@ -764,9 +724,9 @@ GetVariable2 (
   @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
+  @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
@@ -777,6 +737,39 @@ GetEfiGlobalVariable2 (
   OUT UINTN          *Size OPTIONAL\r
   );\r
 \r
+/** Return the attributes of the variable.\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().  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
+  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[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
+  @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
+GetVariable3(\r
+  IN CONST CHAR16       *Name,\r
+  IN CONST EFI_GUID     *Guid,\r
+     OUT VOID           **Value,\r
+     OUT UINTN          *Size OPTIONAL,\r
+     OUT UINT32         *Attr OPTIONAL\r
+  );\r
+\r
 /**\r
   Returns a pointer to an allocated buffer that contains the best matching language\r
   from a set of supported languages.\r
@@ -1283,6 +1276,7 @@ AsciiPrintXY (
   ...\r
   );\r
 \r
+\r
 /**\r
   Installs and completes the initialization of a Driver Binding Protocol instance.\r
 \r
@@ -1315,6 +1309,25 @@ EfiLibInstallDriverBinding (
   );\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
 /**\r
   Installs and completes the initialization of a Driver Binding Protocol instance and\r
   optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
@@ -1354,6 +1367,31 @@ EfiLibInstallAllDriverProtocols (
   );\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
 /**\r
   Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
@@ -1390,6 +1428,29 @@ EfiLibInstallDriverBindingComponentName2 (
   );\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
 /**\r
   Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
   Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
@@ -1434,6 +1495,40 @@ EfiLibInstallAllDriverProtocols2 (
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL\r
   );\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
 /**\r
   Appends a formatted Unicode string to a Null-terminated Unicode string\r
 \r