ArmPlatformPkg/Bds: Fixed 'BootNext' support

The 'BootNext' environment variable should only contain the index of the 'next' boot entry.
It was containing a complete Boot Option.




git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12998 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2012-02-09 15:30:19 +00:00
parent b148591a8c
commit 0e29bf5c91
1 changed files with 33 additions and 8 deletions

View File

@ -390,6 +390,9 @@ BdsEntry (
{ {
UINTN Size; UINTN Size;
EFI_STATUS Status; EFI_STATUS Status;
UINT16 *BootNext;
UINTN BootNextSize;
CHAR16 BootVariableName[9];
PERF_END (NULL, "DXE", NULL, 0); PERF_END (NULL, "DXE", NULL, 0);
@ -404,7 +407,23 @@ BdsEntry (
} }
// If BootNext environment variable is defined then we just load it ! // If BootNext environment variable is defined then we just load it !
Status = BdsStartBootOption (L"BootNext"); BootNextSize = sizeof(UINT16);
Status = GetEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);
if (!EFI_ERROR(Status)) {
ASSERT(BootNextSize == sizeof(UINT16));
// Generate the requested Boot Entry variable name
UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", *BootNext);
// Set BootCurrent variable
gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
BootNextSize, BootNext);
FreePool (BootNext);
// Start the requested Boot Entry
Status = BdsStartBootOption (BootVariableName);
if (Status != EFI_NOT_FOUND) { if (Status != EFI_NOT_FOUND) {
// BootNext has not been succeeded launched // BootNext has not been succeeded launched
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
@ -417,6 +436,12 @@ BdsEntry (
0, NULL); 0, NULL);
} }
// Clear BootCurrent variable
gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL);
}
// If Boot Order does not exist then create a default entry // If Boot Order does not exist then create a default entry
DefineDefaultBootEntries (); DefineDefaultBootEntries ();