From nobody Tue Feb 10 14:49:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+103995+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+103995+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683205941; cv=none; d=zohomail.com; s=zohoarc; b=aI/noCUz0pevpbGGW24C2W5sr1+bACyTZ7jb0tyqHpLdDASiyuXTbN4LQbf7A7YRNaiL7Xyj+aFcmXToJf2/P8Ywmk/KvgRT36oWnchbAWE07jGXLG4BV8P8TcvbStRroPgSng78vnD/DLV0LHT+Rh27AYlcrV8m1CcSjgU3Xuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683205941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=pam40O+/UwxOwMMyWd/7JWHNsd6+M2GEDmaeRlj6Z1M=; b=Mdo9sNaQmiDXSmQni1huQDy6ScUFeDFpxj6dfHctRHOBAKthBwbtmWkSB0Mum7AXlw3ehNk6UHZJJkaQHZTiF3z+UtmI3JDb6MjyowjRN0/TYMZ2j42mY+35/Ht29EtAlhw46YYB31EdCutV3l1DxSduP+xb9KAd4pVR4+ICB1o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+103995+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683205941675462.03498858764635; Thu, 4 May 2023 06:12:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TzaVYY1788612xDNCLYCCJc1; Thu, 04 May 2023 06:12:21 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.49488.1683205940669330954 for ; Thu, 04 May 2023 06:12:20 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-MIV9o6RjPxya27ck1BiI_g-1; Thu, 04 May 2023 09:12:11 -0400 X-MC-Unique: MIV9o6RjPxya27ck1BiI_g-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C14D7800B35; Thu, 4 May 2023 13:12:10 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8B33C15BAE; Thu, 4 May 2023 13:12:06 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 332EE1800986; Thu, 4 May 2023 15:12:01 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , Stefan Berger , Anthony Perard , Jiewen Yao , Julien Grall , Pawel Polawski , Jordan Justen , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 4/4] OvmfPkg/PlatformBootManagerLib: setup virtio serial console Date: Thu, 4 May 2023 15:12:01 +0200 Message-Id: <20230504131201.1026585-5-kraxel@redhat.com> In-Reply-To: <20230504131201.1026585-1-kraxel@redhat.com> References: <20230504131201.1026585-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: KgyPnkLGdMWmAOzRd1Te1qDgx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683205941; bh=J1uiB2HAkBxC3UmjJBeEdJCp3d9HK35QQuDPZslBFgI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=chmUDzq2Lay5IqY6pMoCOhAnxe8nZ3mUplhBe8YqtMR9HhKBp1kQQUwsiFsu9q2aHDt 5h2/0Gnfyya4IYT1qXvFYucFNr2uakMRrmzDaU5o7ACy5XwOY8EsDVQCb31i8s9Mv4Nud 8UqU+yKVNQ2nNPad2vPrRKlUWlWGxnh50dM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683205942903100002 Content-Type: text/plain; charset="utf-8"; x-default="true" In case a virtio-serial device is present in the system register the first serial port as console. Signed-off-by: Gerd Hoffmann --- .../PlatformBootManagerLib/BdsPlatform.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index a90076c9e672..3b7dc53e9f86 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -976,6 +976,45 @@ PreparePciSerialDevicePath ( return EFI_SUCCESS; } =20 +EFI_STATUS +PrepareVirtioSerialDevicePath ( + IN EFI_HANDLE DeviceHandle + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + + DevicePath =3D NULL; + Status =3D gBS->HandleProtocol ( + DeviceHandle, + &gEfiDevicePathProtocolGuid, + (VOID *)&DevicePath + ); + if (EFI_ERROR (Status)) { + return Status; + } + + gPnp16550ComPortDeviceNode.UID =3D 0; + DevicePath =3D AppendDevicePathNode ( + DevicePath, + (EFI_DEVICE_PATH_PROTOCOL *)&gPnp1655= 0ComPortDeviceNode + ); + DevicePath =3D AppendDevicePathNode ( + DevicePath, + (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode + ); + DevicePath =3D AppendDevicePathNode ( + DevicePath, + (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode + ); + + EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL); + + return EFI_SUCCESS; +} + EFI_STATUS VisitAllInstancesOfProtocol ( IN EFI_GUID *Id, @@ -1144,6 +1183,14 @@ DetectAndPreparePlatformPciDevicePath ( return EFI_SUCCESS; } =20 + if (((Pci->Hdr.VendorId =3D=3D 0x1af4) && (Pci->Hdr.DeviceId =3D=3D 0x10= 03)) || + ((Pci->Hdr.VendorId =3D=3D 0x1af4) && (Pci->Hdr.DeviceId =3D=3D 0x10= 43))) + { + DEBUG ((DEBUG_INFO, "Found virtio serial device\n")); + PrepareVirtioSerialDevicePath (Handle); + return EFI_SUCCESS; + } + return Status; } =20 --=20 2.40.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103995): https://edk2.groups.io/g/devel/message/103995 Mute This Topic: https://groups.io/mt/98683338/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-