Hi Ray, This patch looks good to me.
Reviewed by: Sunny Wang <[email protected]> Regards, Sunny Wang -----Original Message----- From: edk2-devel [mailto:[email protected]] On Behalf Of Ruiyu Ni Sent: Monday, November 02, 2015 7:34 PM To: [email protected] Cc: Ruiyu Ni; Eric Dong Subject: [edk2] [Patch 10/11] MdeModulePkg: Add PlatformRecovery#### pointing to default file path Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <[email protected]> Cc: Eric Dong <[email protected]> --- MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 38 +++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c index 4154d41..b632ada 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -823,11 +823,12 @@ BdsEntry ( UINT16 BootTimeOut; EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; UINTN Index; - EFI_BOOT_MANAGER_LOAD_OPTION BootOption; + EFI_BOOT_MANAGER_LOAD_OPTION LoadOption; UINT16 *BootNext; CHAR16 BootNextVariableName[sizeof ("Boot####")]; EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; BOOLEAN BootFwUi; + EFI_DEVICE_PATH_PROTOCOL *FilePath; HotkeyTriggered = NULL; Status = EFI_SUCCESS; @@ -943,6 +944,27 @@ BdsEntry ( InitializeLanguage (TRUE); // + // System firmware must include a PlatformRecovery#### variable + specifying // a short-form File Path Media Device Path containing the + platform default // file path for removable media // FilePath = + FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME); Status = + EfiBootManagerInitializeLoadOption ( + &LoadOption, + 0, + LoadOptionTypePlatformRecovery, + LOAD_OPTION_ACTIVE, + L"Default PlatformRecovery", + FilePath, + NULL, + 0 + ); + ASSERT_EFI_ERROR (Status); + EfiBootManagerLoadOptionToVariable (&LoadOption); + EfiBootManagerFreeLoadOption (&LoadOption); FreePool (FilePath); + + // // Report Status Code to indicate connecting drivers will happen // REPORT_STATUS_CODE ( @@ -1120,17 +1142,17 @@ BdsEntry ( // if (BootNext != NULL) { UnicodeSPrint (BootNextVariableName, sizeof (BootNextVariableName), L"Boot%04x", *BootNext); - Status = EfiBootManagerVariableToLoadOption (BootNextVariableName, &BootOption); + Status = EfiBootManagerVariableToLoadOption (BootNextVariableName, + &LoadOption); if (!EFI_ERROR (Status)) { - EfiBootManagerBoot (&BootOption); - EfiBootManagerFreeLoadOption (&BootOption); - if (BootOption.Status == EFI_SUCCESS) { + EfiBootManagerBoot (&LoadOption); + EfiBootManagerFreeLoadOption (&LoadOption); + if (LoadOption.Status == EFI_SUCCESS) { // // Boot to Boot Manager Menu upon EFI_SUCCESS // - EfiBootManagerGetBootManagerMenu (&BootOption); - EfiBootManagerBoot (&BootOption); - EfiBootManagerFreeLoadOption (&BootOption); + EfiBootManagerGetBootManagerMenu (&LoadOption); + EfiBootManagerBoot (&LoadOption); + EfiBootManagerFreeLoadOption (&LoadOption); } } } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

