]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/BootOption.c
ArmPlatformPkg/BdsLib: Let the user press enter when inputting booleans
[mirror_edk2.git] / ArmPlatformPkg / Bds / BootOption.c
index 289d36a50badb9f44726380a96b53953a9961993..ee0301ef2c9b0c7eac0daad4e25d63ccee91a665 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2013, 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
@@ -12,6 +12,7 @@
 *\r
 **/\r
 \r
+#include <Guid/ArmGlobalVariableHob.h>\r
 #include "BdsInternal.h"\r
 \r
 extern EFI_HANDLE mImageHandle;\r
@@ -76,7 +77,8 @@ BootOptionStart (
 \r
       // Get the FDT device path\r
       FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);\r
-      Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);\r
+      Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid,\r
+                 DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);\r
       ASSERT_EFI_ERROR(Status);\r
 \r
       Status = BdsBootLinuxFdt (BootOption->FilePathList,\r
@@ -120,7 +122,7 @@ BootOptionList (
   InitializeListHead (BootOptionList);\r
 \r
   // Get the Boot Option Order from the environment variable\r
-  Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
+  Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
   if (EFI_ERROR(Status)) {\r
     return Status;\r
   }\r
@@ -286,7 +288,7 @@ BootOptionCreate (
       );\r
 \r
   // Add the new Boot Index to the list\r
-  Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
+  Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
   if (!EFI_ERROR(Status)) {\r
     BootOrder = ReallocatePool (BootOrderSize, BootOrderSize + sizeof(UINT16), BootOrder);\r
     // Add the new index at the end\r
@@ -358,7 +360,7 @@ BootOptionDelete (
   EFI_STATUS    Status;\r
 \r
   // Remove the entry from the BootOrder environment variable\r
-  Status = GetEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
+  Status = GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);\r
   if (!EFI_ERROR(Status)) {\r
     BootOrderCount = BootOrderSize / sizeof(UINT16);\r
 \r
@@ -367,7 +369,11 @@ BootOptionDelete (
       if (BootOrder[Index] == BootOption->LoadOptionIndex) {\r
         // If it the last entry we do not need to rearrange the BootOrder list\r
         if (Index + 1 != BootOrderCount) {\r
-          CopyMem (&BootOrder[Index],&BootOrder[Index+1], BootOrderCount - (Index + 1));\r
+          CopyMem (\r
+            &BootOrder[Index],\r
+            &BootOrder[Index + 1],\r
+            (BootOrderCount - (Index + 1)) * sizeof(UINT16)\r
+            );\r
         }\r
         break;\r
       }\r