]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add PlatformRecovery#### pointing to default file path
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 17 Nov 2015 10:14:13 +0000 (10:14 +0000)
committerniruiyu <niruiyu@Edk2>
Tue, 17 Nov 2015 10:14:13 +0000 (10:14 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18862 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/BdsDxe/BdsEntry.c

index 4154d41372ed5e4de1ac087ec7912e2befd1fce2..b632ada5f6c9cf217b8bb936fc0a6a3494702a14 100644 (file)
@@ -823,11 +823,12 @@ BdsEntry (
   UINT16                          BootTimeOut;\r
   EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;\r
   UINTN                           Index;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION    BootOption;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;\r
   UINT16                          *BootNext;\r
   CHAR16                          BootNextVariableName[sizeof ("Boot####")];\r
   EFI_BOOT_MANAGER_LOAD_OPTION    BootManagerMenu;\r
   BOOLEAN                         BootFwUi;\r
+  EFI_DEVICE_PATH_PROTOCOL        *FilePath;\r
 \r
   HotkeyTriggered = NULL;\r
   Status          = EFI_SUCCESS;\r
@@ -942,6 +943,27 @@ BdsEntry (
   //\r
   InitializeLanguage (TRUE);\r
 \r
+  //\r
+  // System firmware must include a PlatformRecovery#### variable specifying\r
+  // a short-form File Path Media Device Path containing the platform default\r
+  // file path for removable media\r
+  //\r
+  FilePath = FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME);\r
+  Status = EfiBootManagerInitializeLoadOption (\r
+             &LoadOption,\r
+             0,\r
+             LoadOptionTypePlatformRecovery,\r
+             LOAD_OPTION_ACTIVE,\r
+             L"Default PlatformRecovery",\r
+             FilePath,\r
+             NULL,\r
+             0\r
+             );\r
+  ASSERT_EFI_ERROR (Status);\r
+  EfiBootManagerLoadOptionToVariable (&LoadOption);\r
+  EfiBootManagerFreeLoadOption (&LoadOption);\r
+  FreePool (FilePath);\r
+\r
   //\r
   // Report Status Code to indicate connecting drivers will happen\r
   //\r
@@ -1120,17 +1142,17 @@ BdsEntry (
   //\r
   if (BootNext != NULL) {\r
     UnicodeSPrint (BootNextVariableName, sizeof (BootNextVariableName), L"Boot%04x", *BootNext);\r
-    Status = EfiBootManagerVariableToLoadOption (BootNextVariableName, &BootOption);\r
+    Status = EfiBootManagerVariableToLoadOption (BootNextVariableName, &LoadOption);\r
     if (!EFI_ERROR (Status)) {\r
-      EfiBootManagerBoot (&BootOption);\r
-      EfiBootManagerFreeLoadOption (&BootOption);\r
-      if (BootOption.Status == EFI_SUCCESS) {\r
+      EfiBootManagerBoot (&LoadOption);\r
+      EfiBootManagerFreeLoadOption (&LoadOption);\r
+      if (LoadOption.Status == EFI_SUCCESS) {\r
         //\r
         // Boot to Boot Manager Menu upon EFI_SUCCESS\r
         //\r
-        EfiBootManagerGetBootManagerMenu (&BootOption);\r
-        EfiBootManagerBoot (&BootOption);\r
-        EfiBootManagerFreeLoadOption (&BootOption);\r
+        EfiBootManagerGetBootManagerMenu (&LoadOption);\r
+        EfiBootManagerBoot (&LoadOption);\r
+        EfiBootManagerFreeLoadOption (&LoadOption);\r
       }\r
     }\r
   }\r