[edk2-devel] [PATCH v2 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription()
David Woodhouse
dwmw2 at infradead.org
Tue Jun 25 11:48:56 UTC 2019
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 at infradead.org>
Reviewed-by: Laszlo Ersek <lersek at redhat.com>
---
.../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..06edba8b4d 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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#42816): https://edk2.groups.io/g/devel/message/42816
Mute This Topic: https://groups.io/mt/32202512/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list