Looks good to me. Thanks for addressing my comment, Ray. Reviewed-by: Sunny Wang <sunnyw...@hpe.com>
-----Original Message----- From: Ruiyu Ni [mailto:ruiyu...@intel.com] Sent: Friday, June 29, 2018 2:04 PM To: edk2-devel@lists.01.org Cc: Sean Brogan <sean.bro...@microsoft.com>; Michael Turner <michael.tur...@microsoft.com>; Laszlo Ersek <ler...@redhat.com>; Wang, Sunny (HPS SW) <sunnyw...@hpe.com> Subject: [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for ultimate boot failure REF: https://bugzilla.tianocore.org/show_bug.cgi?id=982 When no boot option could be launched including platform recovery options and options pointing to applications built into firmware volumes, a platform callback registered through EfiBootManagerRegisterUnableToBootHandler() is called. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu...@intel.com> Cc: Sean Brogan <sean.bro...@microsoft.com> Cc: Michael Turner <michael.tur...@microsoft.com> Cc: Laszlo Ersek <ler...@redhat.com> Cc: Sunny Wang <sunnyw...@hpe.com> --- MdeModulePkg/Include/Library/UefiBootManagerLib.h | 48 +++++++++++++++++++++++ MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 41 +++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModulePkg/Include/Library/UefiBootManagerLib.h index bfc0cb86f8..453893e030 100644 --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h @@ -800,4 +800,52 @@ EFIAPI EfiBootManagerDispatchDeferredImages ( VOID ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to +applications + built into firmware volumes. + + The platform may register this function to inform the user about the above fact. + If this function returns, BDS core attempts to enter an infinite loop +of pulling + up the Boot Manager Menu (if the platform includes the Boot Manager Menu). + If the Boot Manager Menu is unavailable, BDS will hang. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_UNABLE_TO_BOOT) ( + VOID + ); + +/** + Register the callback function when no boot option could be launched, + including platform recovery options and options pointing to +applications + built into firmware volumes. + + @param Handler The callback function. +**/ +VOID +EFIAPI +EfiBootManagerRegisterUnableToBootHandler ( + EFI_BOOT_MANAGER_UNABLE_TO_BOOT Handler + ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to +applications + built into firmware volumes. + + If this function returns, BDS core attempts to enter an infinite loop + of pulling up the Boot Manager Menu (if the platform includes the Boot Manager Menu). + If the Boot Manager Menu is unavailable, BDS will hang. + + @retval EFI_SUCCESS The unable-to-boot callback is called successfully. + @retval EFI_UNSUPPORTED There is no unable-to-boot callback registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUnableToBoot ( + VOID + ); + #endif diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 6a23477eb8..e59d790122 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -19,6 +19,7 @@ EFI_RAM_DISK_PROTOCOL *mRamDisk = NULL; EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION mBmRefreshLegacyBootOption = NULL; EFI_BOOT_MANAGER_LEGACY_BOOT mBmLegacyBoot = NULL; +EFI_BOOT_MANAGER_UNABLE_TO_BOOT mBmUnableToBoot = NULL; /// /// This GUID is used for an EFI Variable that stores the front device pathes @@ -2461,3 +2462,43 @@ EfiBootManagerGetBootManagerMenu ( } } +/** + Register the callback function when no boot option could be launched, + including platform recovery options and options pointing to +applications + built into firmware volumes. + + @param Handler The callback function. +**/ +VOID +EFIAPI +EfiBootManagerRegisterUnableToBootHandler ( + EFI_BOOT_MANAGER_UNABLE_TO_BOOT Handler + ) +{ + mBmUnableToBoot = Handler; +} + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to +applications + built into firmware volumes. + + If this function returns, BDS core attempts to enter an infinite loop + of pulling up the Boot Manager Menu (if the platform includes the Boot Manager Menu). + If the Boot Manager Menu is unavailable, BDS will hang. + + @retval EFI_SUCCESS The unable-to-boot callback is called successfully. + @retval EFI_UNSUPPORTED There is no unable-to-boot callback registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUnableToBoot ( + VOID + ) +{ + if (mBmUnableToBoot != NULL) { + mBmUnableToBoot (); + return EFI_SUCCESS; + } + return EFI_UNSUPPORTED; +} -- 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel