public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <andrey.warkentin@gmail.com>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie,
	philmd@redhat.com
Subject: [edk2-platforms][PATCH 1/1] RPi4: add descriptive errors in PlatformRegisterOptionsAndKeys
Date: Mon,  1 Jun 2020 00:32:38 -0700	[thread overview]
Message-ID: <20200601073238.101651-1-andrey.warkentin@gmail.com> (raw)

I have reports of debug builds sitting with an ASSERT inside
PlatformRegisterOptionsAndKeys, but have not been able to verify.
Let's log errors to help diagnose this in the future.

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
---
 Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c | 25 ++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index 996ba8f3..f0a2fe1a 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -1,7 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2018, Pete Batard <pete@akeo.ie>
- *  Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ *  Copyright (c) 2017-2020, Andrei Warkentin <andrey.warkentin@gmail.com>
  *  Copyright (c) 2016, Linaro Ltd. All rights reserved.
  *  Copyright (c) 2015-2016, Red Hat, Inc.
  *  Copyright (c) 2014, ARM Ltd. All rights reserved.
@@ -468,7 +468,13 @@ PlatformRegisterOptionsAndKeys (
     F1.ScanCode = SCAN_F1;
     F1.UnicodeChar = CHAR_NULL;
     Status = EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)ShellOption, 0, &F1, NULL);
-    ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
+    if (Status == EFI_ALREADY_STARTED) {
+      Status = EFI_SUCCESS;
+    }
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failed to register F1 as UEFI Shell key: %r\n", Status));
+    }
+    ASSERT_EFI_ERROR (Status);
   }
 
   //
@@ -477,6 +483,9 @@ PlatformRegisterOptionsAndKeys (
   Enter.ScanCode = SCAN_NULL;
   Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
   Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed to register ENTER as CONTINUE key: %r\n", Status));
+  }
   ASSERT_EFI_ERROR (Status);
 
   //
@@ -485,9 +494,17 @@ PlatformRegisterOptionsAndKeys (
   Esc.ScanCode = SCAN_ESC;
   Esc.UnicodeChar = CHAR_NULL;
   Status = EfiBootManagerGetBootManagerMenu (&BootOption);
+  if (!EFI_ERROR (Status)) {
+    Status = EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 0, &Esc, NULL);
+    if (Status == EFI_ALREADY_STARTED) {
+      Status = EFI_SUCCESS;
+    }
+  }
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed to register ESC as Boot Manager key: %r\n", Status));
+  }
   ASSERT_EFI_ERROR (Status);
-  Status = EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 0, &Esc, NULL);
-  ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
 }
 
 STATIC VOID
-- 
2.17.1


             reply	other threads:[~2020-06-01  7:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01  7:32 Andrei Warkentin [this message]
2020-06-01  9:05 ` [edk2-platforms][PATCH 1/1] RPi4: add descriptive errors in PlatformRegisterOptionsAndKeys Ard Biesheuvel
2020-06-01  9:21   ` [edk2-devel] " Andrei Warkentin

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=20200601073238.101651-1-andrey.warkentin@gmail.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