ArmPlatformPkg/Bds: Add support for 'BootCurrent'
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:34:16 +0000 (15:34 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:34:16 +0000 (15:34 +0000)
The UEFI variable 'BootCurrent' defines the EFI application started by the Boot Manager.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13000 6f19259b-4bc3-4df7-8a09-765794883524

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
+  UINT16                                LoadOptionIndexSize;\r
 \r
   if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
     Status = EFI_UNSUPPORTED;\r
@@ -86,7 +87,19 @@ BootOptionStart (
       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
+\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