From nobody Fri Nov 1 00:33:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1526165722065513.0322556227517; Sat, 12 May 2018 15:55:22 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 44F07210C9971; Sat, 12 May 2018 15:55:21 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 91391210C996A for ; Sat, 12 May 2018 15:55:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E020E406F65E; Sat, 12 May 2018 22:55:17 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-16.rdu2.redhat.com [10.10.120.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0567215CDA7; Sat, 12 May 2018 22:55:16 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Sun, 13 May 2018 00:55:14 +0200 Message-Id: <20180512225514.30760-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 12 May 2018 22:55:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 12 May 2018 22:55:17 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH] OvmfPkg/PlatformBootManagerLib: connect consoles unconditionally X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If both ConIn and ConOut exist, but ConIn references none of the PS/2 keyboard, the USB wild-card keyboard, and any serial ports, then PlatformInitializeConsole() currently allows the boot to proceed without any input devices at all. This makes for a bad user experience -- the firmware menu could only be entered through OsIndications, set by a guest OS. Do what ArmVirtQemu does already, namely connect the consoles, and add them to ConIn / ConOut / ErrOut, unconditionally. (The underlying EfiBootManagerUpdateConsoleVariable() function checks for duplicates.) The issue used to be masked by the EfiBootManagerConnectAll() call that got conditionalized in commit 245c643cc8b7. This patch is best viewed with "git show -b -W". Cc: Ard Biesheuvel Cc: Jordan Justen Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d Ref: https://bugzilla.redhat.com/show_bug.cgi?id=3D1577546 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- Notes: Repo: https://github.com/lersek/edk2.git Branch: conn_cons_uncond OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 127 +++++++--------= ----- 1 file changed, 44 insertions(+), 83 deletions(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 862fa6ebb4e5..004b753f4d26 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -26,7 +26,6 @@ VOID *mEfiDevPathNotifyReg; EFI_EVENT mEfiDevPathEvent; VOID *mEmuVariableEventReg; EFI_EVENT mEmuVariableEvent; -BOOLEAN mDetectVgaOnly; UINT16 mHostBridgeDevId; =20 // @@ -830,35 +829,33 @@ DetectAndPreparePlatformPciDevicePath ( ); ASSERT_EFI_ERROR (Status); =20 - if (!mDetectVgaOnly) { + // + // Here we decide whether it is LPC Bridge + // + if ((IS_PCI_LPC (Pci)) || + ((IS_PCI_ISA_PDECODE (Pci)) && + (Pci->Hdr.VendorId =3D=3D 0x8086) && + (Pci->Hdr.DeviceId =3D=3D 0x7000) + ) + ) { // - // Here we decide whether it is LPC Bridge + // Add IsaKeyboard to ConIn, + // add IsaSerial to ConOut, ConIn, ErrOut // - if ((IS_PCI_LPC (Pci)) || - ((IS_PCI_ISA_PDECODE (Pci)) && - (Pci->Hdr.VendorId =3D=3D 0x8086) && - (Pci->Hdr.DeviceId =3D=3D 0x7000) - ) - ) { - // - // Add IsaKeyboard to ConIn, - // add IsaSerial to ConOut, ConIn, ErrOut - // - DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n")); - PrepareLpcBridgeDevicePath (Handle); - return EFI_SUCCESS; - } + DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n")); + PrepareLpcBridgeDevicePath (Handle); + return EFI_SUCCESS; + } + // + // Here we decide which Serial device to enable in PCI bus + // + if (IS_PCI_16550SERIAL (Pci)) { // - // Here we decide which Serial device to enable in PCI bus + // Add them to ConOut, ConIn, ErrOut. // - if (IS_PCI_16550SERIAL (Pci)) { - // - // Add them to ConOut, ConIn, ErrOut. - // - DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n")); - PreparePciSerialDevicePath (Handle); - return EFI_SUCCESS; - } + DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n")); + PreparePciSerialDevicePath (Handle); + return EFI_SUCCESS; } =20 // @@ -877,26 +874,6 @@ DetectAndPreparePlatformPciDevicePath ( } =20 =20 -/** - Do platform specific PCI Device check and add them to ConOut, ConIn, Err= Out - - @param[in] DetectVgaOnly - Only detect VGA device if it's TRUE. - - @retval EFI_SUCCESS - PCI Device check and Console variable update - successfully. - @retval EFI_STATUS - PCI Device check or Console variable update fail. - -**/ -EFI_STATUS -DetectAndPreparePlatformPciDevicePaths ( - BOOLEAN DetectVgaOnly - ) -{ - mDetectVgaOnly =3D DetectVgaOnly; - return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath); -} - - /** Connect the predefined platform default console device. =20 @@ -910,50 +887,34 @@ PlatformInitializeConsole ( ) { UINTN Index; - EFI_DEVICE_PATH_PROTOCOL *VarConout; - EFI_DEVICE_PATH_PROTOCOL *VarConin; =20 // - // Connect RootBridge + // Do platform specific PCI Device check and add them to ConOut, ConIn, + // ErrOut // - GetEfiGlobalVariable2 (EFI_CON_OUT_VARIABLE_NAME, (VOID **) &VarConout, - NULL); - GetEfiGlobalVariable2 (EFI_CON_IN_VARIABLE_NAME, (VOID **) &VarConin, NU= LL); - - if (VarConout =3D=3D NULL || VarConin =3D=3D NULL) { - // - // Do platform specific PCI Device check and add them to ConOut, ConIn, - // ErrOut - // - DetectAndPreparePlatformPciDevicePaths (FALSE); + VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath); =20 + // + // Have chance to connect the platform default console, + // the platform default console is the minimum device group + // the platform should support + // + for (Index =3D 0; PlatformConsole[Index].DevicePath !=3D NULL; ++Index) { // - // Have chance to connect the platform default console, - // the platform default console is the minimum device group - // the platform should support + // Update the console variable with the connect type // - for (Index =3D 0; PlatformConsole[Index].DevicePath !=3D NULL; ++Index= ) { - // - // Update the console variable with the connect type - // - if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) =3D=3D CONSOLE= _IN) { - EfiBootManagerUpdateConsoleVariable (ConIn, - PlatformConsole[Index].DevicePath, NULL); - } - if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) =3D=3D CONSOL= E_OUT) { - EfiBootManagerUpdateConsoleVariable (ConOut, - PlatformConsole[Index].DevicePath, NULL); - } - if ((PlatformConsole[Index].ConnectType & STD_ERROR) =3D=3D STD_ERRO= R) { - EfiBootManagerUpdateConsoleVariable (ErrOut, - PlatformConsole[Index].DevicePath, NULL); - } + if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) =3D=3D CONSOLE_I= N) { + EfiBootManagerUpdateConsoleVariable (ConIn, + PlatformConsole[Index].DevicePath, NULL); + } + if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) =3D=3D CONSOLE_= OUT) { + EfiBootManagerUpdateConsoleVariable (ConOut, + PlatformConsole[Index].DevicePath, NULL); + } + if ((PlatformConsole[Index].ConnectType & STD_ERROR) =3D=3D STD_ERROR)= { + EfiBootManagerUpdateConsoleVariable (ErrOut, + PlatformConsole[Index].DevicePath, NULL); } - } else { - // - // Only detect VGA device and add them to ConOut - // - DetectAndPreparePlatformPciDevicePaths (TRUE); } } =20 --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel