X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPlatformPkg%2FBds%2FBootOption.c;h=289d36a50badb9f44726380a96b53953a9961993;hp=d811c03ccc2030b7224a78601aedf278d9d2d725;hb=91213ad3dd948000e7764352533d60eb183aa234;hpb=c0658bd6b811479b2b502a6dd07839911f0c0bd1;ds=sidebyside diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c index d811c03ccc..289d36a50b 100644 --- a/ArmPlatformPkg/Bds/BootOption.c +++ b/ArmPlatformPkg/Bds/BootOption.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -32,6 +32,7 @@ BootOptionStart ( UINTN CmdLineSize; UINTN InitrdSize; EFI_DEVICE_PATH* Initrd; + UINT16 LoadOptionIndexSize; if (IS_ARM_BDS_BOOTENTRY (BootOption)) { Status = EFI_UNSUPPORTED; @@ -82,9 +83,23 @@ BootOptionStart ( Initrd, // Initrd (CHAR8*)(LinuxArguments + 1), FdtDevicePath); + + FreePool (FdtDevicePath); } } else { + // Set BootCurrent variable + LoadOptionIndexSize = sizeof(UINT16); + gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + LoadOptionIndexSize, &(BootOption->LoadOptionIndex)); + Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData); + + // Clear BootCurrent variable + LoadOptionIndexSize = sizeof(UINT16); + gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + 0, NULL); } return Status; @@ -119,6 +134,8 @@ BootOptionList ( } } + FreePool (BootOrder); + return EFI_SUCCESS; } @@ -290,6 +307,11 @@ BootOptionCreate ( BootOrder ); + // We only free it if the UEFI Variable 'BootOrder' was already existing + if (BootOrderSize > sizeof(UINT16)) { + FreePool (BootOrder); + } + *BdsLoadOption = BootOption; return Status; } @@ -361,5 +383,7 @@ BootOptionDelete ( ); } + FreePool (BootOrder); + return EFI_SUCCESS; }