]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/BdsLib/BdsHelper.c
ArmPkg: Introduce GetGlobalEnvironmentVariable() function.
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsHelper.c
index 5016bedcd48e9dc9bd0dbc794503051d51db3a90..fb2ac9b8062ea5df9ef391ad519197664c52f88e 100644 (file)
@@ -1,14 +1,14 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\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
+*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\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
+*  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
 *\r
 **/\r
 \r
@@ -293,9 +293,22 @@ PrintPerformance (
   SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
 }\r
 \r
+EFI_STATUS\r
+GetGlobalEnvironmentVariable (\r
+  IN     CONST CHAR16*   VariableName,\r
+  IN     VOID*           DefaultValue,\r
+  IN OUT UINTN*          Size,\r
+  OUT    VOID**          Value\r
+  )\r
+{\r
+  return GetEnvironmentVariable (VariableName, &gEfiGlobalVariableGuid,\r
+           DefaultValue, Size, Value);\r
+}\r
+\r
 EFI_STATUS\r
 GetEnvironmentVariable (\r
   IN     CONST CHAR16*   VariableName,\r
+  IN     EFI_GUID*       VendorGuid,\r
   IN     VOID*           DefaultValue,\r
   IN OUT UINTN*          Size,\r
   OUT    VOID**          Value\r
@@ -307,13 +320,13 @@ GetEnvironmentVariable (
   // Try to get the variable size.\r
   *Value = NULL;\r
   VariableSize = 0;\r
-  Status = gRT->GetVariable ((CHAR16 *) VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);\r
+  Status = gRT->GetVariable ((CHAR16 *) VariableName, VendorGuid, NULL, &VariableSize, *Value);\r
   if (Status == EFI_NOT_FOUND) {\r
     if ((DefaultValue != NULL) && (Size != NULL) && (*Size != 0)) {\r
       // If the environment variable does not exist yet then set it with the default value\r
       Status = gRT->SetVariable (\r
                     (CHAR16*)VariableName,\r
-                    &gEfiGlobalVariableGuid,\r
+                    VendorGuid,\r
                     EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
                     *Size,\r
                     DefaultValue\r
@@ -329,7 +342,7 @@ GetEnvironmentVariable (
       return EFI_OUT_OF_RESOURCES;\r
     }\r
 \r
-    Status = gRT->GetVariable ((CHAR16 *)VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);\r
+    Status = gRT->GetVariable ((CHAR16 *)VariableName, VendorGuid, NULL, &VariableSize, *Value);\r
     if (EFI_ERROR (Status)) {\r
       FreePool(*Value);\r
       return EFI_INVALID_PARAMETER;\r