summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds/BdsHelper.c
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-09 10:54:33 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-09 10:54:33 +0000
commit4aa2417061f832009b92aac786ed7307ce088503 (patch)
tree16e5e567b9462b6bbae1458944e64bb9bde32a22 /ArmPlatformPkg/Bds/BdsHelper.c
parent2755d844f9ccc57108b49d5f91f38085de01760a (diff)
downloadedk2-platforms-4aa2417061f832009b92aac786ed7307ce088503.tar.xz
ArmPkg/BdsLib: Move some functions used to create/update BDS Boot Entry from ArmPlatformPkg/Bds to ArmPkg/BdsLib
These functions can be reused by any EFI application to add/update a BDS Boot Entry. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12314 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Bds/BdsHelper.c')
-rw-r--r--ArmPlatformPkg/Bds/BdsHelper.c64
1 files changed, 3 insertions, 61 deletions
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c
index 91b42341e6..7bbe8b89bd 100644
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ b/ArmPlatformPkg/Bds/BdsHelper.c
@@ -15,59 +15,6 @@
#include "BdsInternal.h"
EFI_STATUS
-GetEnvironmentVariable (
- IN CONST CHAR16* VariableName,
- IN VOID* DefaultValue,
- IN OUT UINTN* Size,
- OUT VOID** Value
- )
-{
- EFI_STATUS Status;
- UINTN VariableSize;
-
- // Try to get the variable size.
- *Value = NULL;
- VariableSize = 0;
- Status = gRT->GetVariable ((CHAR16 *) VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);
- if (Status == EFI_NOT_FOUND) {
- if ((DefaultValue != NULL) && (Size != NULL) && (*Size != 0)) {
- // If the environment variable does not exist yet then set it with the default value
- Status = gRT->SetVariable (
- (CHAR16*)VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- *Size,
- DefaultValue
- );
- *Value = DefaultValue;
- } else {
- return EFI_NOT_FOUND;
- }
- } else if (Status == EFI_BUFFER_TOO_SMALL) {
- // Get the environment variable value
- *Value = AllocatePool (VariableSize);
- if (*Value == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable ((CHAR16 *)VariableName, &gEfiGlobalVariableGuid, NULL, &VariableSize, *Value);
- if (EFI_ERROR (Status)) {
- FreePool(*Value);
- return EFI_INVALID_PARAMETER;
- }
-
- if (Size) {
- *Size = VariableSize;
- }
- } else {
- *Value = DefaultValue;
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
EditHIInputStr (
IN OUT CHAR16 *CmdLine,
IN UINTN MaxCmdLine
@@ -321,17 +268,12 @@ BdsStartBootOption (
)
{
EFI_STATUS Status;
- EFI_LOAD_OPTION EfiLoadOption;
- UINTN EfiLoadOptionSize;
BDS_LOAD_OPTION *BdsLoadOption;
- Status = GetEnvironmentVariable (BootOption, NULL, &EfiLoadOptionSize, (VOID**)&EfiLoadOption);
+ Status = BootOptionFromLoadOptionVariable (BootOption, &BdsLoadOption);
if (!EFI_ERROR(Status)) {
- Status = BootOptionParseLoadOption (EfiLoadOption, EfiLoadOptionSize, &BdsLoadOption);
- if (!EFI_ERROR(Status)) {
- Status = BootOptionStart (BdsLoadOption);
- FreePool (BdsLoadOption);
- }
+ Status = BootOptionStart (BdsLoadOption);
+ FreePool (BdsLoadOption);
if (!EFI_ERROR(Status)) {
Status = EFI_SUCCESS;