From mboxrd@z Thu Jan 1 00:00:00 1970 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.web11.5762.1676638939580535658 for ; Fri, 17 Feb 2023 05:02:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IKwJYaRD; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: ppolawsk@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676638938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Valx0Uf65Igze9kdNj6RhyiClBOQTxw0VCzFGtgpHK4=; b=IKwJYaRDxmPYirrhurgpF+LgpzEOtDqPO64us+2IDaNSJ6N4poaSbrmTKstYh5zzK5XtFe JZNhQabjr5E15RqD1zKQufTmzKF+TzSOh9OB1PwFTbeAuZ92zLwI1pjUogeI2+Ngm/oY8F DYj3z67kix8Psk0JwuBc5kHtQMDC1t0= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-550-KnYkOrHaMNOBYyfSIScrbw-1; Fri, 17 Feb 2023 08:02:16 -0500 X-MC-Unique: KnYkOrHaMNOBYyfSIScrbw-1 Received: by mail-lf1-f70.google.com with SMTP id cf28-20020a056512281c00b004a28ba148bbso394618lfb.22 for ; Fri, 17 Feb 2023 05:02:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Valx0Uf65Igze9kdNj6RhyiClBOQTxw0VCzFGtgpHK4=; b=b0rCsFV/Pd++BqlA7JaZka+fLVWtJsa2swAaKi9oEKmsnI1HgWyJ8Hi9UUUwjCxnQu 78bUm23Vu4NsVPQSpcKECg0MR2N6qfCoQBZVJXnmbcHLA31l2VOHY7xkfeXYlqBCbwia S68WkNcNfOJQprMs8F8t+zFwrw28LtS7YH+k4OTJdPVOo7hsXwhuBTt3Bwqa3kA+B9Ob HVcozS9IUAvhVhFq24AD4GCkp4H8SUXS4ide5oSUDbXxD3iDW9uKzLJ2M4HCO89A7C2m pIFb22HTyVpLALKZXrD+f34/sHuwX+ySNUvlvKMDzJfWnSD+vjvE7t4091nebHffKCpy V4IQ== X-Gm-Message-State: AO0yUKUH7Fe444Y0pNOyI2cXiv6EjuXmSAe42qpI94++Etes9LwgNswy UBcjE+2vmvBVSE035fn218TvdnPRiLPPDDgHl+lpOgwWmir+zMp0TokrOjPR8dSeW9kc2GVnVHT xYWz+XHlP697/RTnifXkfFpXfYn/rzFMAtfHyVAYltthdQFUEG9AhOyPM9my1NYLXFdzZXJR3lA == X-Received: by 2002:a05:651c:488:b0:293:5279:30c6 with SMTP id s8-20020a05651c048800b00293527930c6mr372452ljc.25.1676638934760; Fri, 17 Feb 2023 05:02:14 -0800 (PST) X-Google-Smtp-Source: AK7set+oyrQwLxV4lS9wc51wBbcHI+EspC3AHxhQR8tMCi5G8nenaqbLDf4ZR5z7N+2SlnEggfLeLw== X-Received: by 2002:a05:651c:488:b0:293:5279:30c6 with SMTP id s8-20020a05651c048800b00293527930c6mr372409ljc.25.1676638933910; Fri, 17 Feb 2023 05:02:13 -0800 (PST) Return-Path: Received: from czapka.. ([93.177.91.185]) by smtp.gmail.com with ESMTPSA id f20-20020a2e9194000000b002935006e487sm589767ljg.122.2023.02.17.05.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 05:02:13 -0800 (PST) From: =?UTF-8?B?UGF3ZcWCIFBvxYJhd3NraQ==?= To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Gerd Hoffmann Subject: [edk2-devel] PATCH v3 2/3 ArmVirtPkg: take PcdResizeXterm from the QEMU command line Date: Fri, 17 Feb 2023 14:01:38 +0100 Message-Id: <53b02b8098fa09a0d9e9d893a613f12975403929.1675733286.git.ppolawsk@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Laszlo Ersek This patch enables recognition of PcdResizeXterm config variable. When enablet it will trigger passing xterm control sequences from the ArmVirtPkg to the client terminal (xterm, gnome-terminal etc.). This way client terminal window size will be alligned with numbers of rows and columns used by firmware. Signed-off-by: Laszlo Ersek Pawel Polawski: Updated commit message for re-submission Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Cc: Gerd Hoffmann Signed-off-by: Paweł Poławski --- ArmVirtPkg/ArmVirtQemu.dsc | 7 +++- OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf | 33 ++++++++++++++++ OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c | 41 ++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 0f1c6395488a..5f99c0a5104f 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -304,6 +304,8 @@ [PcdsPatchableInModule] gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0 !endif + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE + [PcdsDynamicHii] gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS @@ -418,7 +420,10 @@ [Components.common] MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf - MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf { + + NULL|OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf + } MdeModulePkg/Universal/SerialDxe/SerialDxe.inf MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf diff --git a/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf b/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf new file mode 100644 index 000000000000..b4108ec04b0b --- /dev/null +++ b/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf @@ -0,0 +1,33 @@ +## @file +# Plugin library for setting up dynamic PCDs for TerminalDxe, from fw_cfg +# +# Copyright (c) 2015-2020, Red Hat, Inc. +# Copyright (c) 2014, Linaro Ltd. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = TerminalPcdProducerLib + FILE_GUID = 4a0c5ed7-8c42-4c01-8f4c-7bf258316a96 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = NULL + CONSTRUCTOR = TerminalPcdProducerLibConstructor + +[Sources] + TerminalPcdProducerLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + DebugLib + PcdLib + QemuFwCfgSimpleParserLib + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## SOMETIMES_PRODUCES diff --git a/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c b/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c new file mode 100644 index 000000000000..fe65273822a0 --- /dev/null +++ b/OvmfPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c @@ -0,0 +1,41 @@ +/** @file + + Copyright (c) 2015-2020, Red Hat, Inc. + Copyright (c) 2014, Linaro Ltd. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + + Plugin library for setting up dynamic PCDs for TerminalDxe, from fw_cfg + +**/ + +#include +#include +#include + +#define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName) \ + do { \ + BOOLEAN Setting; \ + RETURN_STATUS PcdStatus; \ + \ + if (!RETURN_ERROR (QemuFwCfgParseBool ( \ + "opt/org.tianocore/" #TokenName, &Setting))) { \ + PcdStatus = PcdSetBoolS (TokenName, Setting); \ + ASSERT_RETURN_ERROR (PcdStatus); \ + } \ + } while (0) + +/** + Update PCD configuration variable from firmware config. + + @return Always returns RETURN_SUCCESS +**/ +RETURN_STATUS +EFIAPI +TerminalPcdProducerLibConstructor ( + VOID + ) +{ + UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm); + return RETURN_SUCCESS; +} -- 2.39.1