From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=hpOtiziI; spf=none, err=permanent DNS error (domain: bombadil.srs.infradead.org, ip: 198.137.202.133, mailfrom: batv+2e1b3bf406a0b60cb2b2+5780+infradead.org+dwmw2@bombadil.srs.infradead.org) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by groups.io with SMTP; Fri, 21 Jun 2019 15:31:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ViD+M79mPoHIBhw677NiFRahzuT/iZSzFUrv9dLcISk=; b=hpOtiziI/mixk48fK/FFusP/rd bE69n9WjNzSIu1htLJ99XnQGh+0/bkrIGd0y58KSi4TwLipsgmSMaHP39PeQY+IFctQRqf0tSYZnD 7k4uUL0agLoe01V1l5LRFzQpIZS8OanYCRGqiMuRB7m+ruXQoXSpu0YOqEgi1C5rmsGTx8urmIZce lWDzY3KWEjeXvXem6ATkIQsp5Me8ZvsJqf36IMoMhtltUhei4TMqQLCRdwP81bQpNtS/CV9aCuIF+ Ye/lVqPN/mP8WDTw/9de9UMtxwoeOo/+3w+at2+/j6XBxPK7EL/BRDCfdPhGv9h/ivhFlWEIQlwYc 1l8ifAfQ==; Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1heS4b-0000KS-SD; Fri, 21 Jun 2019 22:31:57 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1heS4a-002wVR-Jl; Fri, 21 Jun 2019 23:31:56 +0100 From: "David Woodhouse" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ray Ni Subject: [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() Date: Fri, 21 Jun 2019 23:31:53 +0100 Message-Id: <20190621223156.701502-4-dwmw2@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190621223156.701502-1-dwmw2@infradead.org> References: <20190621223156.701502-1-dwmw2@infradead.org> MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Content-Transfer-Encoding: 8bit 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 --- .../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