summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-09 15:30:19 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-09 15:30:19 +0000
commit0e29bf5c91b057a41c9918eb6c996717defaed99 (patch)
tree85f3a553192506dd746a584218181217a97edb8f /ArmPlatformPkg/Bds
parentb148591a8ce071b686aaadad398d599685f33487 (diff)
downloadedk2-platforms-0e29bf5c91b057a41c9918eb6c996717defaed99.tar.xz
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
Diffstat (limited to 'ArmPlatformPkg/Bds')
-rw-r--r--ArmPlatformPkg/Bds/Bds.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index 8f7f9fdf7c..c5246a0f0b 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -390,6 +390,9 @@ BdsEntry (
{
UINTN Size;
EFI_STATUS Status;
+ UINT16 *BootNext;
+ UINTN BootNextSize;
+ CHAR16 BootVariableName[9];
PERF_END (NULL, "DXE", NULL, 0);
@@ -404,16 +407,38 @@ BdsEntry (
}
// If BootNext environment variable is defined then we just load it !
- Status = BdsStartBootOption (L"BootNext");
- if (Status != EFI_NOT_FOUND) {
- // BootNext has not been succeeded launched
- if (EFI_ERROR(Status)) {
- Print(L"Fail to start BootNext.\n");
+ 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) {
+ // BootNext has not been succeeded launched
+ if (EFI_ERROR(Status)) {
+ Print(L"Fail to start BootNext.\n");
+ }
+
+ // Delete the BootNext environment variable
+ gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ 0, NULL);
}
- // Delete the BootNext environment variable
- gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ // Clear BootCurrent variable
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL);
}