diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-15 19:56:50 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-15 19:56:50 +0000 |
commit | 6bab33c7b677dea7a67df512ef1a058daeebef57 (patch) | |
tree | e9016ca1b3d736c5a831e72bc43cb466383d1da9 /ArmPlatformPkg/Bds/BootOption.c | |
parent | e862cd50c6a12183204ba0fa93403d88fd2e0376 (diff) | |
download | edk2-platforms-6bab33c7b677dea7a67df512ef1a058daeebef57.tar.xz |
ArmPlatformPkg/Bds: Fix various bugs in the new BDS
The errors were:
- uncaught returned error
- used of uninitialized variables
ArmPlatformPkg/Bds: Implement the update of MemMap Boot Device
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11830 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Bds/BootOption.c')
-rw-r--r-- | ArmPlatformPkg/Bds/BootOption.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c index a8ba23fe73..d3c7445fae 100644 --- a/ArmPlatformPkg/Bds/BootOption.c +++ b/ArmPlatformPkg/Bds/BootOption.c @@ -258,8 +258,13 @@ BootOptionSetFields ( CopyMem (&((BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments, BootArguments, AsciiStrSize(BootArguments));
BootOption->OptionalData = (BDS_LOADER_OPTIONAL_DATA *)EfiLoadOptionPtr;
+ // If this function is called at the creation of the Boot Device entry (not at the update) the
+ // BootOption->LoadOptionSize must be zero then we get a new BootIndex for this entry
+ if (BootOption->LoadOptionSize == 0) {
+ BootOption->LoadOptionIndex = BootOptionAllocateBootIndex();
+ }
+
// Fill the EFI Load option fields
- BootOption->LoadOptionIndex = BootOptionAllocateBootIndex();
BootOption->LoadOption = EfiLoadOption;
BootOption->LoadOptionSize = EfiLoadOptionSize;
@@ -341,20 +346,20 @@ BootOptionUpdate ( )
{
EFI_STATUS Status;
- BDS_LOAD_OPTION *BootOption;
CHAR16 BootVariableName[9];
// Update the BDS Load Option structure
BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, BootType, BootArguments);
// Update the related environment variables
- UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BootOption->LoadOptionIndex);
+ UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BdsLoadOption->LoadOptionIndex);
+
Status = gRT->SetVariable (
BootVariableName,
&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- BootOption->LoadOptionSize,
- BootOption->LoadOption
+ BdsLoadOption->LoadOptionSize,
+ BdsLoadOption->LoadOption
);
return Status;
|