public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Paweł Poławski" <ppolawsk@redhat.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [[edk2-devel] PATH v1 3/3] ArmVirtPkg: take PcdResizeXterm from the QEMU command line
Date: Tue, 23 Aug 2022 03:02:39 +0200	[thread overview]
Message-ID: <39c43cf39467bdf5139eb350cd89cc4ed953626f.1661215864.git.ppolawsk@redhat.com> (raw)
In-Reply-To: <cover.1661215864.git.ppolawsk@redhat.com>

From: Laszlo Ersek <lersek@redhat.com>

Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Pawel: Updated commit message for re-submission

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
---
 ArmVirtPkg/ArmVirtQemu.dsc                                           |  7 +++-
 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf | 33 +++++++++++++++++++
 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c   | 34 ++++++++++++++++++++
 3 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 9369a88858fd..7ed8870474d3 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -285,6 +285,8 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
 !endif
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
+
 [PcdsDynamicHii]
   gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
 
@@ -387,7 +389,10 @@
   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 {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
+  }
   MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
 
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
diff --git a/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
new file mode 100644
index 000000000000..a51dbd1670a8
--- /dev/null
+++ b/ArmVirtPkg/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.<BR>
+#
+#  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/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
new file mode 100644
index 000000000000..bfd3a6a535f9
--- /dev/null
+++ b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
@@ -0,0 +1,34 @@
+/** @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.<BR>
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/QemuFwCfgSimpleParserLib.h>
+
+#define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)                             \
+          do {                                                                \
+            BOOLEAN       Setting;                                            \
+            RETURN_STATUS PcdStatus;                                          \
+                                                                              \
+            if (!RETURN_ERROR (QemuFwCfgParseBool (                           \
+                    "opt/org.tianocore.edk2.aavmf/" #TokenName, &Setting))) { \
+              PcdStatus = PcdSetBoolS (TokenName, Setting);                   \
+              ASSERT_RETURN_ERROR (PcdStatus);                                \
+            }                                                                 \
+          } while (0)
+
+RETURN_STATUS
+EFIAPI
+TerminalPcdProducerLibConstructor (
+  VOID
+  )
+{
+  UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
+  return RETURN_SUCCESS;
+}
-- 
2.37.2


  parent reply	other threads:[~2022-08-23  1:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  1:02 [[edk2-devel] PATH v1 0/3] Enable support for terminal resize Paweł Poławski
2022-08-23  1:02 ` [[edk2-devel] PATH v1 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Paweł Poławski
2022-08-25  9:27   ` Gerd Hoffmann
2022-08-23  1:02 ` [[edk2-devel] PATH v1 2/3] OvmfPkg: take PcdResizeXterm from the QEMU command line Paweł Poławski
2022-09-05 11:58   ` Ard Biesheuvel
2022-08-23  1:02 ` Paweł Poławski [this message]
2022-08-25  9:43   ` [[edk2-devel] PATH v1 3/3] ArmVirtPkg: " Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39c43cf39467bdf5139eb350cd89cc4ed953626f.1661215864.git.ppolawsk@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox