From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>,
Michael Turner <Michael.Turner@microsoft.com>,
Laszlo Ersek <lersek@redhat.com>, Sunny Wang <sunnywang@hpe.com>
Subject: [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for ultimate boot failure
Date: Fri, 29 Jun 2018 14:03:43 +0800 [thread overview]
Message-ID: <20180629060344.105716-2-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20180629060344.105716-1-ruiyu.ni@intel.com>
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.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Sunny Wang <sunnywang@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
next prev parent reply other threads:[~2018-06-29 6:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 6:03 [PATCH v2 0/2] Enhance BDS to handle ultimate boot failure Ruiyu Ni
2018-06-29 6:03 ` Ruiyu Ni [this message]
2018-06-29 6:43 ` [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for " Wang, Sunny (HPS SW)
2018-06-29 12:40 ` Laszlo Ersek
2018-06-30 1:27 ` Ni, Ruiyu
2018-06-29 6:03 ` [PATCH v2 2/2] MdeModulePkg/BdsDxe: Call *UnableToBoot() " Ruiyu Ni
2018-06-29 6:43 ` Wang, Sunny (HPS SW)
2018-06-29 12:43 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180629060344.105716-2-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox