public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Enable support for terminal resize
@ 2022-11-28  4:35 Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Paweł Poławski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paweł Poławski @ 2022-11-28  4:35 UTC (permalink / raw)
  To: devel

This is re-submission of original patches written by Laszlo Ersek.              
When mode will be changed in the EFI - xterm resolution will                    
change too. Tested with xterm, Gnome terminal and XFCE4 terminal.

Laszlo Ersek (3):
  MdeModulePkg: TerminalDxe: set xterm resolution on mode change
  OvmfPkg: take PcdResizeXterm from the QEMU command line
  ArmVirtPkg: take PcdResizeXterm from the QEMU command line

 MdeModulePkg/MdeModulePkg.dec                                        |  4 ++
 ArmVirtPkg/ArmVirtQemu.dsc                                           |  7 +++-
 OvmfPkg/AmdSev/AmdSevX64.dsc                                         |  1 +
 OvmfPkg/CloudHv/CloudHvX64.dsc                                       |  1 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc                                     |  1 +
 OvmfPkg/Microvm/MicrovmX64.dsc                                       |  2 +-
 OvmfPkg/OvmfPkgIa32.dsc                                              |  1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                                           |  1 +
 OvmfPkg/OvmfPkgX64.dsc                                               |  1 +
 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf | 33 ++++++++++++++++
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf           |  2 +
 OvmfPkg/PlatformPei/PlatformPei.inf                                  |  1 +
 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c   | 41 ++++++++++++++++++++
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c          | 29 ++++++++++++++
 OvmfPkg/PlatformPei/Platform.c                                       | 13 +++++++
 15 files changed, 136 insertions(+), 2 deletions(-)
 create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
 create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c

-- 
2.38.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change
  2022-11-28  4:35 [PATCH v2 0/3] Enable support for terminal resize Paweł Poławski
@ 2022-11-28  4:35 ` Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 2/3] OvmfPkg: take PcdResizeXterm from the QEMU command line Paweł Poławski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paweł Poławski @ 2022-11-28  4:35 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Liming Gao

From: Laszlo Ersek <lersek@redhat.com>

Allow TerminalDxe outputs an XTerm resize sequence on
terminal mode change
Reference: <http://rtfm.etla.org/xterm/ctlseq.html>

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

Pawel Polawski: Updated commit message for re-submission

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
---
 MdeModulePkg/MdeModulePkg.dec                               |  4 +++
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf  |  2 ++
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c | 29 ++++++++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 58e6ab004882..e8c011c1bafe 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2102,6 +2102,10 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025
 
+  ## Controls whether TerminalDxe outputs an XTerm resize sequence on terminal
+  #  mode change.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
index b2a8aeba8510..eff625346539 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -55,6 +55,7 @@
   DebugLib
   PcdLib
   BaseLib
+  PrintLib
 
 [Guids]
   ## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
@@ -87,6 +88,7 @@
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType           ## SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable    ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm             ## CONSUMES
 
 # [Event]
 # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index 7809869e7d49..496849458db4 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include <Library/PrintLib.h>
+
 #include "Terminal.h"
 
 //
@@ -80,6 +82,15 @@ CHAR16  mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0
 CHAR16  mCursorForwardString[]     = { ESC, '[', '0', '0', 'C', 0 };
 CHAR16  mCursorBackwardString[]    = { ESC, '[', '0', '0', 'D', 0 };
 
+//
+// Note that this is an ASCII format string, taking two INT32 arguments:
+// rows, columns.
+//
+// A %d (INT32) format specification can expand to at most 11 characters.
+//
+CHAR8  mResizeTextAreaFormatString[] = "\x1B[8;%d;%dt";
+#define RESIZE_SEQ_SIZE  (sizeof mResizeTextAreaFormatString + 2 * (11 - 2))
+
 //
 // Body of the ConOut functions
 //
@@ -498,6 +509,24 @@ TerminalConOutSetMode (
     return EFI_DEVICE_ERROR;
   }
 
+  if (PcdGetBool (PcdResizeXterm)) {
+    CHAR16  ResizeSequence[RESIZE_SEQ_SIZE];
+
+    UnicodeSPrintAsciiFormat (
+      ResizeSequence,
+      sizeof ResizeSequence,
+      mResizeTextAreaFormatString,
+      (INT32)TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,
+      (INT32)TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns
+      );
+    TerminalDevice->OutputEscChar = TRUE;
+    Status                        = This->OutputString (This, ResizeSequence);
+    TerminalDevice->OutputEscChar = FALSE;
+    if (EFI_ERROR (Status)) {
+      return EFI_DEVICE_ERROR;
+    }
+  }
+
   This->Mode->Mode = (INT32)ModeNumber;
 
   Status = This->ClearScreen (This);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] OvmfPkg: take PcdResizeXterm from the QEMU command line
  2022-11-28  4:35 [PATCH v2 0/3] Enable support for terminal resize Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Paweł Poławski
@ 2022-11-28  4:35 ` Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 3/3] ArmVirtPkg: " Paweł Poławski
  2022-11-28  8:59 ` [edk2-devel] [PATCH v2 0/3] Enable support for terminal resize Ard Biesheuvel
  3 siblings, 0 replies; 5+ messages in thread
From: Paweł Poławski @ 2022-11-28  4:35 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann

From: Laszlo Ersek <lersek@redhat.com>

Allow enable XTerm resize sequences on terminal mode
changes via QEMU command line

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

Pawel Polawski: Updated commit message for re-submission

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc        |  1 +
 OvmfPkg/CloudHv/CloudHvX64.dsc      |  1 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc    |  1 +
 OvmfPkg/Microvm/MicrovmX64.dsc      |  2 +-
 OvmfPkg/OvmfPkgIa32.dsc             |  1 +
 OvmfPkg/OvmfPkgIa32X64.dsc          |  1 +
 OvmfPkg/OvmfPkgX64.dsc              |  1 +
 OvmfPkg/PlatformPei/PlatformPei.inf |  1 +
 OvmfPkg/PlatformPei/Platform.c      | 13 +++++++++++++
 9 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 8f7cae787e97..41ad97b47dc9 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -475,6 +475,7 @@
 [PcdsDynamicDefault]
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index ce277cb2398b..faab59ae8d74 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -582,6 +582,7 @@
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 345892651520..4c4da09b9024 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -474,6 +474,7 @@
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 994a02d30107..1d5ba0e810a1 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -579,7 +579,7 @@
   # only set when
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
-
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 6f774baf90f5..e8a074153a77 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -601,6 +601,7 @@
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index c851764dec05..0197997793a9 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -609,6 +609,7 @@
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 63c3a47aea30..fade13b4e80c 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -631,6 +631,7 @@
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index 1fadadeb5565..3e28e1596d32 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -99,6 +99,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index b1f8140d6041..e5132d95a8f8 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -41,6 +41,18 @@
 
 #include "Platform.h"
 
+#define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)                   \
+          do {                                                      \
+            BOOLEAN       Setting;                                  \
+            RETURN_STATUS PcdStatus;                                \
+                                                                    \
+            if (!RETURN_ERROR (QemuFwCfgParseBool (                 \
+                              "opt/ovmf/" #TokenName, &Setting))) { \
+              PcdStatus = PcdSetBoolS (TokenName, Setting);         \
+              ASSERT_RETURN_ERROR (PcdStatus);                      \
+            }                                                       \
+          } while (0)
+
 EFI_HOB_PLATFORM_INFO  mPlatformInfoHob = { 0 };
 
 EFI_PEI_PPI_DESCRIPTOR  mPpiBootMode[] = {
@@ -376,6 +388,7 @@ InitializePlatform (
     MemTypeInfoInitialization ();
     MemMapInitialization (&mPlatformInfoHob);
     NoexecDxeInitialization ();
+    UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
   }
 
   InstallClearCacheCallback ();
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] ArmVirtPkg: take PcdResizeXterm from the QEMU command line
  2022-11-28  4:35 [PATCH v2 0/3] Enable support for terminal resize Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Paweł Poławski
  2022-11-28  4:35 ` [PATCH v2 2/3] OvmfPkg: take PcdResizeXterm from the QEMU command line Paweł Poławski
@ 2022-11-28  4:35 ` Paweł Poławski
  2022-11-28  8:59 ` [edk2-devel] [PATCH v2 0/3] Enable support for terminal resize Ard Biesheuvel
  3 siblings, 0 replies; 5+ messages in thread
From: Paweł Poławski @ 2022-11-28  4:35 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Gerd Hoffmann

From: Laszlo Ersek <lersek@redhat.com>

Allow enable XTerm resize sequences on terminal mode
changes via QEMU command line

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

Pawel Polawski: 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   | 41 ++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index f77443229e8e..ed66f0003082 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -299,6 +299,8 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
 !endif
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
+
 [PcdsDynamicHii]
   gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
 
@@ -413,7 +415,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..b4108ec04b0b
--- /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..783f133d671a
--- /dev/null
+++ b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
@@ -0,0 +1,41 @@
+/** @file
+
+   Copyright (c) 2015-2020, Red Hat, Inc.
+   Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
+
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+   Plugin library for setting up dynamic PCDs for TerminalDxe, from fw_cfg
+
+**/
+
+#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)
+
+/**
+   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.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH v2 0/3] Enable support for terminal resize
  2022-11-28  4:35 [PATCH v2 0/3] Enable support for terminal resize Paweł Poławski
                   ` (2 preceding siblings ...)
  2022-11-28  4:35 ` [PATCH v2 3/3] ArmVirtPkg: " Paweł Poławski
@ 2022-11-28  8:59 ` Ard Biesheuvel
  3 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2022-11-28  8:59 UTC (permalink / raw)
  To: devel, ppolawsk

On Mon, 28 Nov 2022 at 05:35, Paweł Poławski <ppolawsk@redhat.com> wrote:
>
> This is re-submission of original patches written by Laszlo Ersek.
> When mode will be changed in the EFI - xterm resolution will
> change too. Tested with xterm, Gnome terminal and XFCE4 terminal.
>

I think I know why this is a good thing, but can you explain anyway?

> Laszlo Ersek (3):
>   MdeModulePkg: TerminalDxe: set xterm resolution on mode change
>   OvmfPkg: take PcdResizeXterm from the QEMU command line
>   ArmVirtPkg: take PcdResizeXterm from the QEMU command line
>

Some of these arrived whitespace mangled in my inbox - can you please
double check you git send-email config?


>  MdeModulePkg/MdeModulePkg.dec                                        |  4 ++
>  ArmVirtPkg/ArmVirtQemu.dsc                                           |  7 +++-
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                         |  1 +
>  OvmfPkg/CloudHv/CloudHvX64.dsc                                       |  1 +
>  OvmfPkg/IntelTdx/IntelTdxX64.dsc                                     |  1 +
>  OvmfPkg/Microvm/MicrovmX64.dsc                                       |  2 +-
>  OvmfPkg/OvmfPkgIa32.dsc                                              |  1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc                                           |  1 +
>  OvmfPkg/OvmfPkgX64.dsc                                               |  1 +
>  ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf | 33 ++++++++++++++++
>  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf           |  2 +
>  OvmfPkg/PlatformPei/PlatformPei.inf                                  |  1 +
>  ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c   | 41 ++++++++++++++++++++
>  MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c          | 29 ++++++++++++++
>  OvmfPkg/PlatformPei/Platform.c                                       | 13 +++++++
>  15 files changed, 136 insertions(+), 2 deletions(-)
>  create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
>  create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
>
> --
> 2.38.1
>
>
>
> 
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-28  8:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-28  4:35 [PATCH v2 0/3] Enable support for terminal resize Paweł Poławski
2022-11-28  4:35 ` [PATCH v2 1/3] MdeModulePkg: TerminalDxe: set xterm resolution on mode change Paweł Poławski
2022-11-28  4:35 ` [PATCH v2 2/3] OvmfPkg: take PcdResizeXterm from the QEMU command line Paweł Poławski
2022-11-28  4:35 ` [PATCH v2 3/3] ArmVirtPkg: " Paweł Poławski
2022-11-28  8:59 ` [edk2-devel] [PATCH v2 0/3] Enable support for terminal resize Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox