public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Ruiyu Ni <ruiyu.ni@intel.com>, edk2-devel@lists.01.org
Subject: Re: [PATCH] OvmfPkg/BDS: Provide platform callback for ultimate boot failure
Date: Fri, 29 Jun 2018 14:49:55 +0200	[thread overview]
Message-ID: <05aad720-fda7-f267-6104-43acff467dfc@redhat.com> (raw)
In-Reply-To: <20180629060548.100012-1-ruiyu.ni@intel.com>

Hi Ray,

thanks a lot for this patch, I have some small logic requests:

On 06/29/18 08:05, Ruiyu Ni wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
>  .../Library/PlatformBootManagerLib/BdsPlatform.c   | 56 ++++++++++++++++++++--
>  1 file changed, 51 insertions(+), 5 deletions(-)
> 
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
> index 57870cb856..3b59ba9397 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
> +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Platform BDS customizations.
>  
> -  Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>    This program and the accompanying materials are licensed and made available
>    under the terms and conditions of the BSD License which accompanies this
>    distribution.  The full text of the license may be found at
> @@ -337,6 +337,50 @@ SaveS3BootScript (
>  //
>  // BDS Platform Functions
>  //
> +
> +VOID
> +EFIAPI
> +UnableToBoot (
> +  VOID
> +  )
> +{
> +  EFI_STATUS                      Status;
> +  UINTN                           Index;
> +  EFI_INPUT_KEY                   Key;
> +  EFI_BOOT_MANAGER_LOAD_OPTION    BootManagerMenu;
> +  //
> +  // AsciiPrint() will NULL-check gST->ConOut internally. We check gST->ConIn
> +  // here to see if it makes sense to request and wait for a keypress.
> +  //
> +  if (gST->ConIn != NULL) {
> +    AsciiPrint (
> +      "%a: No bootable option or device was found.\n"
> +      "%a: Press any key to enter the Boot Manager Menu.\n",
> +      gEfiCallerBaseName,
> +      gEfiCallerBaseName
> +      );
> +    Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);
> +    ASSERT_EFI_ERROR (Status);
> +    ASSERT (Index == 0);
> +
> +    //
> +    // Drain any queued keys.
> +    //
> +    while (!EFI_ERROR (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key))) {
> +      //
> +      // just throw away Key
> +      //
> +    }
> +  }
> +
> +  Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);

(1) In order to preserve the previous behavior, can you please move this
function call to the top of UnableToBoot(), and return silently if the
boot manager menu is not found?

That will cause generic BDS to hang at once (silently), which is
identical to the previous behavior. I'd like to preserve that.

> +  if (!EFI_ERROR (Status)) {
> +    while (TRUE) {
> +      EfiBootManagerBoot (&BootManagerMenu);
> +    }
> +  }
> +}
> +
>  /**
>    Do the platform init, can be customized by OEM/IBV
>  
> @@ -410,6 +454,8 @@ PlatformBootManagerBeforeConsole (
>  
>    PlatformRegisterOptionsAndKeys ();
>  
> +  EfiBootManagerRegisterUnableToBootHandler (UnableToBoot);
> +
>    //
>    // Install both VIRTIO_DEVICE_PROTOCOL and (dependent) EFI_RNG_PROTOCOL
>    // instances on Virtio PCI RNG devices.
> @@ -1531,14 +1577,14 @@ PlatformBootManagerAfterConsole (
>    //
>    PlatformBdsConnectSequence ();
>  
> -  EfiBootManagerRefreshAllBootOption ();
> +  //EfiBootManagerRefreshAllBootOption ();
>  
>    //
>    // Register UEFI Shell
>    //
> -  PlatformRegisterFvBootOption (
> -    PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
> -    );
> +  //PlatformRegisterFvBootOption (
> +  //  PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
> +  //  );
>  
>    RemoveStaleFvFileOptions ();
>    SetBootOrderFromQemu ();
> 

(2) I think the changes you did to PlatformBootManagerAfterConsole()
were for your local testing; can you please remove them from the patch?

I hope we can commit the next version of this patch, and then I will
port it to "ArmVirtPkg/Library/PlatformBootManagerLib" as well.

Many thanks!
Laszlo


      reply	other threads:[~2018-06-29 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  6:05 [PATCH] OvmfPkg/BDS: Provide platform callback for ultimate boot failure Ruiyu Ni
2018-06-29 12:49 ` Laszlo Ersek [this message]

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=05aad720-fda7-f267-6104-43acff467dfc@redhat.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