public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [edk2-devel] [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription()
Date: Tue, 25 Jun 2019 02:00:22 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C1EDD71@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190621223156.701502-4-dwmw2@infradead.org>

David,
I am afraid it will cause issues when exposing EfiBootManagerGetBootDescription().
If you check the implementation, this API visits mPlatformBootDescriptionHandlers.
mPlatformBootDescriptionHandlers is modified by another already-exposed API
EfiBootManagerRegisterBootDescriptionHandler().

The *Register* API is to provide a capability to PlatformBootManagerLib to create
boot option description for special/platform-specific boot options.

But the implicit requirement is boot option description can only be retrieved within
BdsDxe driver because only BdsDxe driver links to PlatformBootManagerLib.

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of David
> Woodhouse
> Sent: Saturday, June 22, 2019 6:32 AM
> To: devel@edk2.groups.io
> Cc: Laszlo Ersek <lersek@redhat.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH 4/7] MdeModulePkg/UefiBootManagerLib:
> export EfiBootManagerGetBootDescription()
> 
> It would be useful for LegacyBiosDxe to be able to get descriptive names for
> block devices, for legacy boot options. It gets a bit confusing when they're all
> called "Harddisk".
> 
> Since we have a collection of the special cases for various types of device
> already in BmGetBootDescription(), let's export that with a minor tweak to
> let the caller set the "UEFI " vs. "Legacy " prefix.
> 
> There's no way we want to reproduce all those device-specific special cases
> again in the LegacyBiosDxe. It's bad enough that they exist in
> UefiBootManagerLib in the first place, instead of being in a protocol provided
> by the individual disk drivers themselves.
> 
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
> ---
>  .../Include/Library/UefiBootManagerLib.h      | 16 ++++++++++++
>  .../UefiBootManagerLib/BmBootDescription.c    | 26 ++++++++++++++++---
>  2 files changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h
> b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
> index 0b69a6021d..a9d6bfda88 100644
> --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h
> +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h
> @@ -249,6 +249,22 @@ EfiBootManagerFindLoadOption (
>    IN UINTN                              Count
>    );
> 
> +/**
> +  Return the boot description for the controller.
> +
> +  @param Prefix                String prefix (e.g "UEFI " or "Legacy ").
> +  @param Handle                Controller handle.
> +
> +  @return  The description string.
> +**/
> +CHAR16 *
> +EFIAPI
> +EfiBootManagerGetBootDescription (
> +  IN CHAR16                     *Prefix,
> +  IN EFI_HANDLE                  Handle
> +  );
> +
> +
>  //
>  // Boot Manager hot key library functions.
>  //
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> index aa891feb17..dd4d160f31 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
> @@ -758,12 +758,15 @@ BM_GET_BOOT_DESCRIPTION
> mBmBootDescriptionHandlers[] = {
>  /**
>    Return the boot description for the controller.
> 
> +  @param Prefix                String prefix (e.g "UEFI " or "Legacy ").
>    @param Handle                Controller handle.
> 
>    @return  The description string.
>  **/
>  CHAR16 *
> -BmGetBootDescription (
> +EFIAPI
> +EfiBootManagerGetBootDescription (
> +  IN CHAR16                     *Prefix,
>    IN EFI_HANDLE                  Handle
>    )
>  {
> @@ -785,10 +788,10 @@ BmGetBootDescription (
>        // Avoid description confusion between UEFI & Legacy boot option by
> adding "UEFI " prefix
>        // ONLY for core provided boot description handler.
>        //
> -      Temp = AllocatePool (StrSize (DefaultDescription) + sizeof
> (mBmUefiPrefix));
> +      Temp = AllocatePool (StrSize (DefaultDescription) + StrSize
> + (Prefix));
>        ASSERT (Temp != NULL);
> -      StrCpyS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) /
> sizeof (CHAR16), mBmUefiPrefix);
> -      StrCatS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) /
> sizeof (CHAR16), DefaultDescription);
> +      StrCpyS (Temp, (StrSize (DefaultDescription) + StrSize (Prefix)) / sizeof
> (CHAR16), Prefix);
> +      StrCatS (Temp, (StrSize (DefaultDescription) + StrSize (Prefix))
> + / sizeof (CHAR16), DefaultDescription);
>        FreePool (DefaultDescription);
>        DefaultDescription = Temp;
>        break;
> @@ -814,6 +817,21 @@ BmGetBootDescription (
>    return DefaultDescription;
>  }
> 
> +/**
> +  Return the boot description for the controller, for UEFI boot.
> +
> +  @param Handle                Controller handle.
> +
> +  @return  The description string.
> +**/
> +CHAR16 *
> +BmGetBootDescription (
> +  IN EFI_HANDLE                  Handle
> +  )
> +{
> +  return EfiBootManagerGetBootDescription(mBmUefiPrefix, Handle); }
> +
>  /**
>    Enumerate all boot option descriptions and append " 2"/" 3"/... to make
>    unique description.
> --
> 2.21.0
> 
> 
> 


  parent reply	other threads:[~2019-06-25  2:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 22:31 [PATCH 1/7] OvmfPkg/LegacyBios: set NumberBbsEntries to the size of BbsTable David Woodhouse
2019-06-21 22:31 ` [PATCH 2/7] OvmfPkg/LegacyBbs: Add boot entries for VirtIO and NVME devices David Woodhouse
2019-06-24 22:46   ` [edk2-devel] " Laszlo Ersek
2019-06-21 22:31 ` [PATCH 3/7] OvmfPkg: Don't build in QemuVideoDxe when we have CSM David Woodhouse
2019-06-21 22:31 ` [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() David Woodhouse
2019-06-24 22:36   ` [edk2-devel] " Laszlo Ersek
2019-06-25  2:00   ` Ni, Ray [this message]
2019-06-25  8:00     ` David Woodhouse
2019-06-21 22:31 ` [PATCH 5/7] OvmfPkg/LegacyBiosDxe: Use EfiBootManagerGetBootDescription() David Woodhouse
2019-06-24 23:03   ` [edk2-devel] " Laszlo Ersek
2019-06-21 22:31 ` [PATCH 6/7] MdeModulePkg/UefiBootManagerLib: describe VirtIO devices correctly David Woodhouse
2019-06-24 23:16   ` [edk2-devel] " Laszlo Ersek
2019-06-25  1:44     ` Ni, Ray
2019-06-25  7:40       ` David Woodhouse
2019-06-25  8:06         ` Ni, Ray
2019-06-25  8:28           ` David Woodhouse
2019-06-25  9:15             ` Ni, Ray
2019-06-25  9:28               ` David Woodhouse
2019-06-25  9:56                 ` Ni, Ray
2019-06-25 11:27                   ` David Woodhouse
2019-06-21 22:31 ` [PATCH 7/7] OvmfPkg: don't assign PCI BARs above 4GiB when CSM enabled David Woodhouse
2019-06-24 23:50   ` [edk2-devel] " Laszlo Ersek
2019-06-25 12:07     ` David Woodhouse

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=734D49CCEBEEF84792F5B80ED585239D5C1EDD71@SHSMSX104.ccr.corp.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