From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=009SusQ3; spf=none, err=permanent DNS error (domain: merlin.srs.infradead.org, ip: 205.233.59.134, mailfrom: batv+68c2678543dae80936a2+5784+infradead.org+dwmw2@merlin.srs.infradead.org) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by groups.io with SMTP; Tue, 25 Jun 2019 04:49:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=DpfvKi1quDxjZrAZXwNhMbff+bRA8om0zw4yzVBb/8o=; b=009SusQ3CFDAjOCsEga4UANOZA H+JyEK1ZmLNNV2rtlrMUIaZGiRmLQVzMDzdz55RVRJuAy70KvgNj85cSG8s4S2J6y5CA1ANFCMMNI 8Cl8XN174/epuGiTtoDLsJbBnd+mrWo+cz5MfCBEB38JN7g2M29PqUjPSLZo51JB4ydhahzMOIsL3 HkIGhg6Vn54xIx859016tRpH/sCnN8cGD8SIUrEqZpF6eOvrFg0bAMPu3jYnJ4ALlY4s4UO6m4X9a X+IynhzLrp0DBstdxKncXRTYP7VfYHTHt4UgYmZ/vQWUMcse/JrUn8sqadkdS/yklIFgZlXkGqpY3 orRBTf6A==; Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hfjwZ-0007hD-UL; Tue, 25 Jun 2019 11:49:00 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hfjwZ-003Kut-5B; Tue, 25 Jun 2019 12:48:59 +0100 From: "David Woodhouse" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ray Ni Subject: [PATCH v2 5/7] OvmfPkg/LegacyBiosDxe: Use EfiBootManagerGetBootDescription() Date: Tue, 25 Jun 2019 12:48:57 +0100 Message-Id: <20190625114859.795331-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625114859.795331-1-dwmw2@infradead.org> References: <20190625114859.795331-1-dwmw2@infradead.org> MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.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 | 47 ++++++++++++++++++++- OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf | 1 + 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c index 5e4c7a249e..f3cc64f89d 100644 --- a/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c +++ b/OvmfPkg/Csm/LegacyBiosDxe/LegacyBbs.c @@ -8,6 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "LegacyBiosInterface.h" #include +#include // Give floppy 3 states // FLOPPY_PRESENT_WITH_MEDIA = Floppy controller present and media is inserted @@ -280,6 +281,8 @@ LegacyBiosBuildBbs ( UINTN BusNum; UINTN DevNum; UINTN FuncNum; + CHAR16 *Description; + CHAR8 AsciiDescription[32]; for (Removable = 0; Removable < 2; Removable++) { for (BlockIndex = 0; BlockIndex < NumberBlockIoHandles; BlockIndex++) { @@ -372,8 +375,48 @@ LegacyBiosBuildBbs ( continue; } - DEBUG ((DEBUG_INFO, "Add Legacy Bbs entry for PCI %d/%d/%d\n", - BusNum, DevNum, FuncNum)); + Description = EfiBootManagerGetBootDescription(L"Legacy ", BlockIoHandles[BlockIndex]); + + DEBUG ((DEBUG_INFO, "Add Legacy Bbs entry for PCI %d/%d/%d: %s\n", + BusNum, DevNum, FuncNum, Description ? Description : L"")); + + if (Description != NULL) { + VOID *BbsDescription; + + // + // Truncate Description and convert to ASCII. + // + if (StrLen (Description) >= sizeof (AsciiDescription)) { + Description[sizeof (AsciiDescription) - 1] = L'0'; + } + UnicodeStrToAsciiStrS (Description, AsciiDescription, sizeof (AsciiDescription)); + + // + // Copy to low memory and reference from BbsTable + // + Status = Private->LegacyBios.GetLegacyRegion( + &Private->LegacyBios, + AsciiStrSize(AsciiDescription), + (UINTN)0, /* Any region */ + (UINTN)1, /* Alignment */ + &BbsDescription + ); + + if (!EFI_ERROR (Status)) { + Status = Private->LegacyBios.CopyLegacyRegion ( + &Private->LegacyBios, + AsciiStrSize(AsciiDescription), + BbsDescription, + AsciiDescription + ); + } + 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; 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