From nobody Tue Feb 10 04:03:06 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+103078+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+103078+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681722212; cv=none; d=zohomail.com; s=zohoarc; b=R6r1IyCEEPTuBxEpryNymgIsc1v5dZOaUV7JFAEgL3pJ9XrLtCaHkVngMbMwv9zrmFHvlTr+sOhKBhkWy8FUZ2z37PZnM99TFCx+WuF83kPtKh1vv0lXpVccwykpOnPQtY1QbnbA9afWr0oaJi5K5ij/6pLG9i8QreGd5VR5+Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681722212; 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=7H2q0JR4ij5UE9ho2ApFeaSTj8iLI+gF1jN8d4+LjAQ=; b=cQcHLuMIuYwr5hBaWWNzQPMFsFxau57jhf0bi+VelaIjuVMMABsaqHtyeuZ/IFCJzUj10xRmkH/6nWwjE6VMjV0AvguGkv8AW8VSUfIc8l6t3JWULU+JRqMfzGV9EXZlIh9kIo/Ud7s7PCnPek2L2qRQAfdJN36fMoWviBjml1k= 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+103078+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 1681722212478453.6276568341016; Mon, 17 Apr 2023 02:03:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JHXyYY1788612xCmCJj5Koks; Mon, 17 Apr 2023 02:03:32 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.50084.1681722211414100293 for ; Mon, 17 Apr 2023 02:03:31 -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-616-pbL2ys1SOR61iSbxbyQp3A-1; Mon, 17 Apr 2023 05:03:27 -0400 X-MC-Unique: pbL2ys1SOR61iSbxbyQp3A-1 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C40F884EC1; Mon, 17 Apr 2023 09:03:27 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C981C40CFD40; Mon, 17 Apr 2023 09:03:26 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 17B8618003A1; Mon, 17 Apr 2023 11:03:20 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Stefan Berger , Julien Grall , Anthony Perard , Ard Biesheuvel , Jordan Justen , Pawel Polawski , Oliver Steffen , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH 4/4] OvmfPkg/PlatformBootManagerLib: setup virtio serial console Date: Mon, 17 Apr 2023 11:03:20 +0200 Message-Id: <20230417090320.225046-5-kraxel@redhat.com> In-Reply-To: <20230417090320.225046-1-kraxel@redhat.com> References: <20230417090320.225046-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: uOM5PkZWn7PNXIuPceX1LU6kx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1681722212; bh=3jA5oMNPlL0XfTAW3N76Og3Po0bG1WtwfeSXKw3YowM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=SQbyIQ9d2GE6By+7iyRgWz5H1xIo4lEl4MwiwIzOBUrNkf3CXVuvG/pxd+MKNBvkQ7/ rJ1wAMgiVw2Ts8sC90SED3eo64rBeemEZyUq17wwRB2Pu4dDQRDkq0LzeQ/YKQ7i/TPVo aLa3HH2oZxuGieChXk0iIo0tSlxhkt5eJ2M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1681722214692100013 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.39.2 -=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 (#103078): https://edk2.groups.io/g/devel/message/103078 Mute This Topic: https://groups.io/mt/98315345/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-