From nobody Thu Nov 14 17:22:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45552+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565697493; cv=none; d=zoho.com; s=zohoarc; b=YDDSXbHNR0uB3R7F0WYav+UsYbn+cGpm5rEbFg0KbK3zcWlZJPsuZjhxcvBUWH3yDm7QvmMvm91LMW08GZfgvGb0QNkey5Vc3Z8+AKkgqX8pckptRbBBPnDFmom+pr/JvT+ywIvabnL4LyjvXw/LPuK6H/a1HaWAr0NkuVNsim8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565697493; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Cqw8T2pP/GbofOHVsbY18B01pJZs4fnALzuczW1frME=; b=eaSWn00ClXOkhW55KSnEXRoXl3PFJWulXG+qlHvcaHgtg51wcf7wGRN29rlDB63VZqRChJ3I21GYyAFiJTZ/6WW8w43E17IvHRSAC5ar8PsXpw0wtrtJkLm32pgiTIB5cG3VMKNIG5ch0ajZZN3JIYnTGwszUNj5VQdh4qEHOA0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45552+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565697493255503.7833736321943; Tue, 13 Aug 2019 04:58:13 -0700 (PDT) Return-Path: X-Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com []) by groups.io with SMTP; Tue, 13 Aug 2019 04:58:11 -0700 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45552+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Zrvu6fLvVDO8W1GC0aIK5SfixZpX5ou96PRyInnWMeUQl/sEWLvFyqy/O77lgXEQzGNoSX42K/ wywCmNuJ2BmHd664w0nufGHPt0+SzmROqauSN7dZ5FUWQXuEVh5osL0iefPoedlhCUvH60Fg3T nMAChHS2QwyNGMvJlylaVcl6DB3GVvFJer7NrjgkxezSZk2LFBmO/P5+c6to4jWST7WVdE06wQ usOkle8IkKr39ubTL60zyJEiqkgSyR7w2qDC7LTqS3W4JWfJxKm8ik78Ex3yXq58t67Fum0nri ZHI= X-SBRS: 2.7 X-MesageID: 4347490 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,381,1559534400"; d="scan'208";a="4347490" From: "Anthony PERARD" To: CC: Laszlo Ersek , Jordan Justen , Julien Grall , , Ard Biesheuvel , Anthony PERARD Subject: [edk2-devel] [PATCH v5 31/35] OvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConIn Date: Tue, 13 Aug 2019 12:31:15 +0100 Message-ID: <20190813113119.14804-32-anthony.perard@citrix.com> In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,anthony.perard@citrix.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565697492; bh=Cqw8T2pP/GbofOHVsbY18B01pJZs4fnALzuczW1frME=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ul4P+z9W4PHjrhAudbeG62ulVuRrjxxPT5YYX5KHwByYXVLiWecNvmwZm03faCRPMsM pFjX0uDWSu1pCrn9UF0FXAx8o6KVhSq2t1CaGQi1uf+UP82OnkMUhuuZPqIRjt8jQwN0U PFRWaVcLs6rj4aXONGCIJwIioDBzeC+QBds= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" On a Xen PVH guest, none of the existing serial or console interface works, so we add a new one, based on XenConsoleSerialPortLib, and implemented via SerialDxe. That is a simple console implementation that can work on both PVH guest and HVM guests, even if it is rarely going to be used on HVM. Have PlatformBootManagerLib look for the new console, when running as a Xen guest. Since we use VENDOR_UART_DEVICE_PATH, fix its description and coding style. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1689 Signed-off-by: Anthony PERARD Reviewed-by: Laszlo Ersek --- Notes: v5: - fix typos in commit message. =20 v4: - instead of creating a new XEN_CONSOLE_DEVICE_PATH, use the existing VENDOR_UART_DEVICE_PATH. And explain why VENDOR_UART_DEVICE_PATH changed in the commit message. =20 v3: - removed PciSioSerialDxe and IsaSerialDxe from OvmfXen, since they would not be used, maybe, to check. - some coding style fix =20 - not changed: PciSioSerialDxe: even if we add SerialDxe, we still needs PciSioSerialDxe to have OVMF use the emulated serial port on HVM. =20 v2: - Use MdeModulePkg/Universal/SerialDxe instead of something new. - Have PlatformInitializeConsole() look for it by using the known-in-advance device path for the xen console in the PLATFORM_CONSOLE_CONNECT_ENTRY. OvmfPkg/OvmfXen.dsc | 4 ++ OvmfPkg/OvmfXen.fdf | 1 + .../PlatformBootManagerLib.inf | 4 ++ .../PlatformBootManagerLib/BdsPlatform.h | 1 + .../PlatformBootManagerLib/BdsPlatform.c | 3 +- .../PlatformBootManagerLib/PlatformData.c | 49 +++++++++++++++++-- 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 54ac910d8e..e719a168f8 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -586,6 +586,10 @@ [Components] OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf OvmfPkg/XenBusDxe/XenBusDxe.inf OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf { + + SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSeri= alPortLib.inf + } MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf index fa0830a324..5c1a925d6a 100644 --- a/OvmfPkg/OvmfXen.fdf +++ b/OvmfPkg/OvmfXen.fdf @@ -312,6 +312,7 @@ [FV.DXEFV] INF OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf INF OvmfPkg/XenBusDxe/XenBusDxe.inf INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf +INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf =20 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRun= timeDxe.inf diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 04d614cd49..f89cce1879 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -61,6 +61,10 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits ## CONSUMES =20 [Pcd.IA32, Pcd.X64] gEfiMdePkgTokenSpaceGuid.PcdFSBClock diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.h index 49a072b400..153e215101 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -165,6 +165,7 @@ typedef struct { #define CONSOLE_IN BIT1 #define STD_ERROR BIT2 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[]; +extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[]; =20 // // Platform BDS Functions diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 1eba304f09..70df6b841a 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -398,7 +398,8 @@ PlatformBootManagerBeforeConsole ( // EfiBootManagerDispatchDeferredImages (); =20 - PlatformInitializeConsole (gPlatformConsole); + PlatformInitializeConsole ( + XenDetected() ? gXenPlatformConsole : gPlatformConsole); PcdStatus =3D PcdSet16S (PcdPlatformBootTimeOut, GetFrontPageTimeoutFromQemu ()); ASSERT_RETURN_ERROR (PcdStatus); diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPk= g/Library/PlatformBootManagerLib/PlatformData.c index 36aab784d7..2858c3dfd5 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c @@ -9,18 +9,19 @@ =20 #include "BdsPlatform.h" #include +#include =20 // -// Debug Agent UART Device Path structure +// Vendor UART Device Path structure // -#pragma pack(1) +#pragma pack (1) typedef struct { VENDOR_DEVICE_PATH VendorHardware; UART_DEVICE_PATH Uart; VENDOR_DEVICE_PATH TerminalType; EFI_DEVICE_PATH_PROTOCOL End; } VENDOR_UART_DEVICE_PATH; -#pragma pack() +#pragma pack () =20 // // USB Keyboard Device Path structure @@ -141,6 +142,37 @@ STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath = =3D { gEndEntire }; =20 +STATIC VENDOR_UART_DEVICE_PATH gXenConsoleDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EDKII_SERIAL_PORT_LIB_VENDOR_GUID + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_UART_DP, + { + (UINT8) (sizeof (UART_DEVICE_PATH)), + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) + } + }, + 0, + FixedPcdGet64 (PcdUartDefaultBaudRate), + FixedPcdGet8 (PcdUartDefaultDataBits), + FixedPcdGet8 (PcdUartDefaultParity), + FixedPcdGet8 (PcdUartDefaultStopBits), + }, + gPcAnsiTerminal, + gEndEntire +}; + // // Predefined platform default console device path // @@ -163,6 +195,17 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = =3D { } }; =20 +PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[] =3D { + { + (EFI_DEVICE_PATH_PROTOCOL *)&gXenConsoleDevicePath, + (CONSOLE_OUT | CONSOLE_IN | STD_ERROR) + }, + { + NULL, + 0 + } +}; + // // Predefined platform connect sequence // --=20 Anthony PERARD -=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 (#45552): https://edk2.groups.io/g/devel/message/45552 Mute This Topic: https://groups.io/mt/32851700/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-