From: "Agyeman, Prince" <prince.agyeman@intel.com>
To: devel@edk2.groups.io
Cc: Michael Kubacki <michael.a.kubacki@intel.com>,
Chasel Chiu <chasel.chiu@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms] [PATCH 06/11] BoardModulePkg: Add Generic BoardBootManagerLib
Date: Fri, 13 Dec 2019 17:32:32 -0800 [thread overview]
Message-ID: <97f98fc0ed58cf75513694f674f8c0124dbab647.1576282834.git.prince.agyeman@intel.com> (raw)
In-Reply-To: <cover.1576282834.git.prince.agyeman@intel.com>
This library implements a generic PlatformBootManagerWaitCallback
and PlatformBootManagerUnableToBoot which will be linked Minplatform's
PlatformBootManager library instance.
Cc: Michael Kubacki <michael.a.kubacki@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
---
.../BoardBootManagerLib/BoardBootManager.c | 103 ++++++++++++++++++
.../BoardBootManagerLib.inf | 39 +++++++
.../BoardBootManagerLib.c | 2 +-
3 files changed, 143 insertions(+), 1 deletion(-)
create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManager.c
create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManagerLib.inf
diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManager.c b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManager.c
new file mode 100644
index 0000000000..f6628d4125
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManager.c
@@ -0,0 +1,103 @@
+/** @file
+ This file include board specific boot manager callbacks
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PlatformBootManagerLib.h>
+#include <Library/UefiLib.h>
+#include <Library/HobLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PerformanceLib.h>
+#include <Library/BoardBootManagerLib.h>
+
+
+BOOLEAN mHotKeypressed = FALSE;
+EFI_EVENT HotKeyEvent = NULL;
+UINTN mBootMenuOptionNumber;
+
+/**
+ This function is called each second during the boot manager waits timeout.
+
+ @param TimeoutRemain The remaining timeout.
+**/
+VOID
+EFIAPI
+BoardBootManagerWaitCallback (
+ UINT16 TimeoutRemain
+ )
+{
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;
+ EFI_KEY_DATA KeyData;
+ BOOLEAN PausePressed;
+
+ //
+ // Pause on PAUSE key
+ //
+ Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **) &TxtInEx);
+ ASSERT_EFI_ERROR (Status);
+
+ PausePressed = FALSE;
+
+ while (TRUE) {
+ Status = TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ if (KeyData.Key.ScanCode == SCAN_PAUSE) {
+ PausePressed = TRUE;
+ break;
+ }
+ }
+
+ //
+ // Loop until non-PAUSE key pressed
+ //
+ while (PausePressed) {
+ Status = TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_INFO, "[PauseCallback] %x/%x %x/%x\n",
+ KeyData.Key.ScanCode, KeyData.Key.UnicodeChar,
+ KeyData.KeyState.KeyShiftState, KeyData.KeyState.KeyToggleState
+ ));
+ PausePressed = (BOOLEAN) (KeyData.Key.ScanCode == SCAN_PAUSE);
+ }
+ }
+}
+
+/**
+ 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 attempts to enter an infinite loop.
+**/
+VOID
+EFIAPI
+BoardBootManagerUnableToBoot (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MANAGER_LOAD_OPTION BootDeviceList;
+ CHAR16 OptionName[sizeof ("Boot####")];
+
+ if (mBootMenuOptionNumber == LoadOptionNumberUnassigned) {
+ return;
+ }
+ UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", mBootMenuOptionNumber);
+ Status = EfiBootManagerVariableToLoadOption (OptionName, &BootDeviceList);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ for (;;) {
+ EfiBootManagerBoot (&BootDeviceList);
+ }
+}
diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManagerLib.inf b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManagerLib.inf
new file mode 100644
index 0000000000..38ff52ca81
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootManagerLib.inf
@@ -0,0 +1,39 @@
+## @file
+# The module definition file for BoardBootManagerLib.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BoardBootManagerLib
+ FILE_GUID = E7512AE0-6CB1-47ED-B6FF-94A97A86BABB
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = BoardBootManagerLib|DXE_DRIVER
+
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ BoardBootManager.c
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
+ DebugLib
+ UefiLib
+ HobLib
+ UefiBootManagerLib
+ TimerLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MinPlatformPkg/MinPlatformPkg.dec
diff --git a/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/BoardBootManagerLib.c b/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/BoardBootManagerLib.c
index 46fce8f59f..6bc518f02c 100644
--- a/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/BoardBootManagerLib.c
+++ b/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/BoardBootManagerLib.c
@@ -1,7 +1,7 @@
/** @file
This file include board specific boot manager callbacks
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
--
2.19.1.windows.1
next prev parent reply other threads:[~2019-12-14 1:32 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-14 1:32 [edk2-platforms] [PATCH 00/11] Add BDS Hook Points Agyeman, Prince
2019-12-14 1:32 ` [edk2-platforms] [PATCH 01/11] MinPlatformPkg: Add BDS Hook Point Guids Agyeman, Prince
2019-12-16 1:31 ` Chiu, Chasel
2019-12-16 8:50 ` [edk2-devel] " Ni, Ray
2019-12-17 23:58 ` Kubacki, Michael A
2019-12-18 0:11 ` Ni, Ray
2019-12-18 1:31 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 02/11] BoardModulePkg: Add BDS Hook Library Agyeman, Prince
2019-12-18 1:19 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 03/11] BoardModulePkg: Add BDS Hook DXE Driver Agyeman, Prince
2019-12-18 1:32 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 04/11] MinPlatformPkg: Add BDS Board Boot Manager library Agyeman, Prince
2019-12-17 4:24 ` Chiu, Chasel
2019-12-18 1:33 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 05/11] MinPlatformPkg: Add BDS Hook Points Agyeman, Prince
2019-12-17 5:44 ` Chiu, Chasel
2019-12-18 1:33 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` Agyeman, Prince [this message]
2019-12-18 1:34 ` [edk2-platforms] [PATCH 06/11] BoardModulePkg: Add Generic BoardBootManagerLib Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 07/11] KabylakeOpenBoardPkg: Add BDS Hook Dxe Driver Agyeman, Prince
2019-12-17 5:44 ` Chiu, Chasel
2019-12-18 1:35 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 08/11] WhiskeylakeOpenBoardPkg: " Agyeman, Prince
2019-12-17 5:45 ` Chiu, Chasel
2019-12-18 1:35 ` Nate DeSimone
2019-12-21 2:36 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 09/11] SimicsOpenBoardPkg: Add Bds Hook Library Agyeman, Prince
2019-12-18 1:29 ` Nate DeSimone
2019-12-21 2:37 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 10/11] SimicsOpenBoardPkg: Add BDS Board Boot Manager library Agyeman, Prince
2019-12-18 1:35 ` Nate DeSimone
2019-12-21 2:37 ` Kubacki, Michael A
2019-12-14 1:32 ` [edk2-platforms] [PATCH 11/11] SimicsOpenBoardPkg: Add Bds Hook Points Agyeman, Prince
2019-12-18 1:36 ` Nate DeSimone
2019-12-21 2:37 ` Kubacki, Michael A
2020-04-21 20:37 ` [edk2-devel] [edk2-platforms] [PATCH 00/11] Add BDS " Nate DeSimone
2020-04-22 10:31 ` Leif Lindholm
2020-04-22 22:13 ` Nate DeSimone
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=97f98fc0ed58cf75513694f674f8c0124dbab647.1576282834.git.prince.agyeman@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