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=cw6+uOya; 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: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To: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=K5rzey/zvS1g1+L6tF4T6Y4L8d1m2ShVgRX2ahTaoFI=; b=cw6+uOyag/iiTG0m8EfZ+YmoI3 Yq4ba/lUMMt05m+ij79gEwNMnm/ZITXLfUnfXrExMcPll7UnvELVLvPCDF6LJyDs9XTp6U9b6hX7m fFZO36XC9TbU9S/IG2KuwJfqRg9UH02R6clTYpP25yJaiLjfbs7fNBTt0dOeoaN8ZFUEO1J2dvv+2 DFheP0+DvrU6DAxe6YFl/uZZ6+1ct5uMuR+8u3afc7BBVyKZRiSieZPr9Lc5w6jP8FWvix/kxoqGD 4DP9p6cRcep9jSijKqzyG5Kb/6sCqOJp04Uog8q7lZLqY3vBz7SrwABwgAdOtYTKOMlhPENSTnLl+ ekb89tjQ==; 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-0000KT-SH; Fri, 21 Jun 2019 22:31:58 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1heS4a-002wVW-KI; Fri, 21 Jun 2019 23:31:56 +0100 From: "David Woodhouse" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ray Ni Subject: [PATCH 5/7] OvmfPkg/LegacyBiosDxe: Use EfiBootManagerGetBootDescription() Date: Fri, 21 Jun 2019 23:31:54 +0100 Message-Id: <20190621223156.701502-5-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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No longer call all NVMe & VirtIO devices just "Harddisk". Admittedly, VirtIO disks are now just called 'Misc Device' instead, but at least that is now Someone Else's Problemâ„¢. Signed-off-by: David Woodhouse --- OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c | 46 ++++++++++++++++++++- OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf | 1 + 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c index cc84712d25..0e9896e102 100644 --- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c +++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c @@ -8,6 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "LegacyBiosInterface.h" #include +#include + +#define LEGACY_BBS_BOOT_DESCRIPTION_LENGTH 32 // Give floppy 3 states // FLOPPY_PRESENT_WITH_MEDIA = Floppy controller present and media is inserted @@ -279,6 +282,8 @@ LegacyBiosBuildBbs ( UINTN BusNum; UINTN DevNum; UINTN FuncNum; + CHAR16 *Description; + CHAR8 DescriptionA[LEGACY_BBS_BOOT_DESCRIPTION_LENGTH]; for (Removable = 0; Removable < 2; Removable++) { for (BlockIndex = 0; BlockIndex < NumberBlockIoHandles; BlockIndex++) { @@ -370,16 +375,55 @@ LegacyBiosBuildBbs ( continue; } + Description = EfiBootManagerGetBootDescription(L"Legacy ", BlockIoHandles[BlockIndex]); + DEBUG_CODE ( CHAR16 *PathText; PathText = ConvertDevicePathToText(DevicePath, FALSE, FALSE); DEBUG((EFI_D_INFO, "Add Legacy Bbs entry for PCI %d/%d/%d: %s\n", - BusNum, DevNum, FuncNum, PathText)); + BusNum, DevNum, FuncNum, Description ? Description : L"")); FreePool(PathText); ); + if (Description != NULL) { + VOID *BbsDescription = NULL; + // + // Truncate Description and convert to ASCII. + // + if (StrLen (Description) >= LEGACY_BBS_BOOT_DESCRIPTION_LENGTH) { + Description[LEGACY_BBS_BOOT_DESCRIPTION_LENGTH - 1] = 0; + } + UnicodeStrToAsciiStrS (Description, DescriptionA, sizeof (DescriptionA)); + + // + // Copy to low memory and reference from BbsTable + // + Status = Private->LegacyBios.GetLegacyRegion( + &Private->LegacyBios, + AsciiStrSize(DescriptionA), + (UINTN)0, /* Any region */ + (UINTN)1, /* Alignment */ + &BbsDescription + ); + + if (!EFI_ERROR (Status)) { + Status = Private->LegacyBios.CopyLegacyRegion ( + &Private->LegacyBios, + AsciiStrSize(DescriptionA), + BbsDescription, + DescriptionA + ); + } + if (!EFI_ERROR (Status)) { + BbsTable[BbsIndex].DescStringSegment = (UINT16) (((UINTN) BbsDescription >> 16) << 12); + BbsTable[BbsIndex].DescStringOffset = (UINT16) (UINTN) BbsDescription; + } + + FreePool (Description); + } + BbsTable[BbsIndex].Bus = BusNum; BbsTable[BbsIndex].Device = DevNum; BbsTable[BbsIndex].Function = FuncNum; diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf index f6379dcc46..0b9fef02dc 100644 --- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf +++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf @@ -55,6 +55,7 @@ [LibraryClasses] DevicePathLib UefiBootServicesTableLib + UefiBootManagerLib MemoryAllocationLib UefiDriverEntryPoint BaseMemoryLib -- 2.21.0