]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/BootOption.c
ArmPlatformPkg/Bds: Add support for 'BootCurrent'
[mirror_edk2.git] / ArmPlatformPkg / Bds / BootOption.c
index 3710178a43c83abc109fe912d73f0f692a092f89..289d36a50badb9f44726380a96b53953a9961993 100644 (file)
@@ -32,6 +32,7 @@ BootOptionStart (
   UINTN                                 CmdLineSize;\r
   UINTN                                 InitrdSize;\r
   EFI_DEVICE_PATH*                      Initrd;\r
   UINTN                                 CmdLineSize;\r
   UINTN                                 InitrdSize;\r
   EFI_DEVICE_PATH*                      Initrd;\r
+  UINT16                                LoadOptionIndexSize;\r
 \r
   if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
     Status = EFI_UNSUPPORTED;\r
 \r
   if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
     Status = EFI_UNSUPPORTED;\r
@@ -86,7 +87,19 @@ BootOptionStart (
       FreePool (FdtDevicePath);\r
     }\r
   } else {\r
       FreePool (FdtDevicePath);\r
     }\r
   } else {\r
+    // Set BootCurrent variable\r
+    LoadOptionIndexSize = sizeof(UINT16);\r
+    gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+              EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+              LoadOptionIndexSize, &(BootOption->LoadOptionIndex));\r
+\r
     Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
     Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
+\r
+    // Clear BootCurrent variable\r
+    LoadOptionIndexSize = sizeof(UINT16);\r
+    gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+              EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+              0, NULL);\r
   }\r
 \r
   return Status;\r
   }\r
 \r
   return Status;\r