render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame 0013-MdeModulePkg-TerminalDxe-set-xterm-resolution-on-mod.patch

59c3cd
From 9485b38e5dbfd2e23ea6ad0585e773d7842a1903 Mon Sep 17 00:00:00 2001
Paolo Bonzini 348500
From: Laszlo Ersek <lersek@redhat.com>
Paolo Bonzini 348500
Date: Tue, 25 Feb 2014 22:40:01 +0100
59c3cd
Subject: MdeModulePkg: TerminalDxe: set xterm resolution on mode change (RH
59c3cd
 only)
Paolo Bonzini 348500
59c3cd
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
59c3cd
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
Paolo Bonzini 348500
59c3cd
- Resolve harmless conflict in "MdeModulePkg/MdeModulePkg.dec",
59c3cd
  originating from new upstream commits
59c3cd
  - 45bc28172fbf ("MdeModulePkg.dec: Change PCDs for status code.",
59c3cd
                  2020-06-18),
59c3cd
  - 0785c619a58a ("MdeModulePkg/Bus/Pci/PciBusDxe: Support PCIe Resizable
59c3cd
                  BAR Capability", 2021-01-04),
59c3cd
  - ef23012e5439 ("MdeModulePkg: Change default value of
59c3cd
                  PcdPcieResizableBarSupport to FALSE", 2021-01-14).
Paolo Bonzini 348500
59c3cd
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
59c3cd
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
Paolo Bonzini 348500
59c3cd
- Resolve trivial conflict in "MdeModulePkg/MdeModulePkg.dec", arising
59c3cd
  from upstream commit 166830d8f7ca ("MdeModulePkg/dec: add
59c3cd
  PcdTcgPfpMeasurementRevision PCD", 2020-01-06).
Paolo Bonzini 348500
59c3cd
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
59c3cd
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
Paolo Bonzini 348500
59c3cd
- Conflict in "MdeModulePkg/MdeModulePkg.dec" due to upstream commits
59c3cd
  - 1103ba946aee ("MdeModulePkg: Add Capsule On Disk related definition.",
59c3cd
    2019-06-26),
59c3cd
  - 1c7b3eb84631 ("MdeModulePkg/DxeIpl: Introduce PCD
59c3cd
    PcdUse5LevelPageTable", 2019-08-09),
59c3cd
  with easy manual resolution.
Paolo Bonzini 348500
59c3cd
Notes about the RHEL-8.0/20180508-ee3198e672e2 ->
59c3cd
RHEL-8.1/20190308-89910a39dcfd rebase:
59c3cd
59c3cd
- no change
59c3cd
59c3cd
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
59c3cd
RHEL-8.0/20180508-ee3198e672e2 rebase:
59c3cd
59c3cd
- reorder the rebase changelog in the commit message so that it reads like
59c3cd
  a blog: place more recent entries near the top
59c3cd
- no changes to the patch body
59c3cd
59c3cd
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
59c3cd
59c3cd
- no change
Paolo Bonzini 348500
Paolo Bonzini 348500
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
Paolo Bonzini 348500
Paolo Bonzini 348500
- Refresh downstream-only commit 2909e025db68 against "MdeModulePkg.dec"
Paolo Bonzini 348500
  context change from upstream commits e043f7895b83 ("MdeModulePkg: Add
Paolo Bonzini 348500
  PCD PcdPteMemoryEncryptionAddressOrMask", 2017-02-27) and 76081dfcc5b2
Paolo Bonzini 348500
  ("MdeModulePkg: Add PROMPT&HELP string of pcd to UNI file", 2017-03-03).
Paolo Bonzini 348500
59c3cd
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
59c3cd
59c3cd
- refresh commit 519b9751573e against various context changes
59c3cd
59c3cd
The
59c3cd
59c3cd
  CSI Ps ; Ps ; Ps t
59c3cd
59c3cd
escape sequence serves for window manipulation. We can use the
59c3cd
59c3cd
  CSI 8 ; <rows> ; <columns> t
59c3cd
59c3cd
sequence to adapt eg. the xterm window size to the selected console mode.
59c3cd
Paolo Bonzini 348500
Reference: <http://rtfm.etla.org/xterm/ctlseq.html>
Paolo Bonzini 348500
Contributed-under: TianoCore Contribution Agreement 1.0
Paolo Bonzini 348500
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Paolo Bonzini 348500
(cherry picked from commit 2909e025db6878723b49644a8a0cf160d07e6444)
59c3cd
(cherry picked from commit b9c5c901f25e48d68eef6e78a4abca00e153f574)
59c3cd
(cherry picked from commit b7f6115b745de8cbc5214b6ede33c9a8558beb90)
59c3cd
(cherry picked from commit 67415982afdc77922aa37496c981adeb4351acdb)
59c3cd
(cherry picked from commit cfccb98d13e955beb0b93b4a75a973f30c273ffc)
59c3cd
(cherry picked from commit a11602f5e2ef930be5b693ddfd0c789a1bd4c60c)
59c3cd
(cherry picked from commit bc2266f20de5db1636e09a07e4a72c8dbf505f5a)
Paolo Bonzini 348500
---
Paolo Bonzini 7ae6f1
 MdeModulePkg/MdeModulePkg.dec                 |  4 +++
Paolo Bonzini 7ae6f1
 .../Console/TerminalDxe/TerminalConOut.c      | 30 +++++++++++++++++++
Paolo Bonzini 7ae6f1
 .../Console/TerminalDxe/TerminalDxe.inf       |  2 ++
Paolo Bonzini 348500
 3 files changed, 36 insertions(+)
Paolo Bonzini 348500
Paolo Bonzini 348500
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
59c3cd
index ba2d0290e7..ff70d6e6eb 100644
Paolo Bonzini 348500
--- a/MdeModulePkg/MdeModulePkg.dec
Paolo Bonzini 348500
+++ b/MdeModulePkg/MdeModulePkg.dec
59c3cd
@@ -2046,6 +2046,10 @@
59c3cd
   # @Prompt Enable PCIe Resizable BAR Capability support.
59c3cd
   gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x10000024
Paolo Bonzini 348500
 
Paolo Bonzini 348500
+  ## Controls whether TerminalDxe outputs an XTerm resize sequence on terminal
Paolo Bonzini 348500
+  #  mode change.
Paolo Bonzini 348500
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE|BOOLEAN|0x00010080
Paolo Bonzini 348500
+
Paolo Bonzini 348500
 [PcdsPatchableInModule]
Paolo Bonzini 348500
   ## Specify memory size with page number for PEI code when
Paolo Bonzini 348500
   #  Loading Module at Fixed Address feature is enabled.
Paolo Bonzini 348500
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
0a0d66
index aae470e956..26156857aa 100644
Paolo Bonzini 348500
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
Paolo Bonzini 348500
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
740797
@@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
Paolo Bonzini 348500
 
Paolo Bonzini 348500
 **/
Paolo Bonzini 348500
 
Paolo Bonzini 348500
+#include <Library/PrintLib.h>
Paolo Bonzini 348500
+
Paolo Bonzini 348500
 #include "Terminal.h"
Paolo Bonzini 348500
 
Paolo Bonzini 348500
 //
740797
@@ -80,6 +82,16 @@ CHAR16 mSetCursorPositionString[]  = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0
Paolo Bonzini 7ae6f1
 CHAR16 mCursorForwardString[]      = { ESC, '[', '0', '0', 'C', 0 };
Paolo Bonzini 348500
 CHAR16 mCursorBackwardString[]     = { ESC, '[', '0', '0', 'D', 0 };
Paolo Bonzini 348500
 
Paolo Bonzini 7ae6f1
+//
Paolo Bonzini 348500
+// Note that this is an ASCII format string, taking two INT32 arguments:
Paolo Bonzini 348500
+// rows, columns.
Paolo Bonzini 348500
+//
Paolo Bonzini 348500
+// A %d (INT32) format specification can expand to at most 11 characters.
Paolo Bonzini 348500
+//
Paolo Bonzini 348500
+CHAR8 mResizeTextAreaFormatString[] = "\x1B[8;%d;%dt";
Paolo Bonzini 348500
+#define RESIZE_SEQ_SIZE (sizeof mResizeTextAreaFormatString + 2 * (11 - 2))
Paolo Bonzini 348500
+
Paolo Bonzini 348500
+
Paolo Bonzini 7ae6f1
 //
Paolo Bonzini 348500
 // Body of the ConOut functions
Paolo Bonzini 348500
 //
0a0d66
@@ -506,6 +518,24 @@ TerminalConOutSetMode (
Paolo Bonzini 348500
     return EFI_DEVICE_ERROR;
Paolo Bonzini 348500
   }
Paolo Bonzini 348500
 
Paolo Bonzini 348500
+  if (PcdGetBool (PcdResizeXterm)) {
Paolo Bonzini 348500
+    CHAR16 ResizeSequence[RESIZE_SEQ_SIZE];
Paolo Bonzini 348500
+
Paolo Bonzini 348500
+    UnicodeSPrintAsciiFormat (
Paolo Bonzini 348500
+      ResizeSequence,
Paolo Bonzini 348500
+      sizeof ResizeSequence,
Paolo Bonzini 348500
+      mResizeTextAreaFormatString,
Paolo Bonzini 348500
+      (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows,
Paolo Bonzini 348500
+      (INT32) TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns
Paolo Bonzini 348500
+      );
Paolo Bonzini 348500
+    TerminalDevice->OutputEscChar = TRUE;
Paolo Bonzini 348500
+    Status                        = This->OutputString (This, ResizeSequence);
Paolo Bonzini 348500
+    TerminalDevice->OutputEscChar = FALSE;
Paolo Bonzini 348500
+    if (EFI_ERROR (Status)) {
Paolo Bonzini 348500
+      return EFI_DEVICE_ERROR;
Paolo Bonzini 348500
+    }
Paolo Bonzini 348500
+  }
Paolo Bonzini 348500
+
Paolo Bonzini 348500
   This->Mode->Mode  = (INT32) ModeNumber;
Paolo Bonzini 348500
 
Paolo Bonzini 348500
   Status            = This->ClearScreen (This);
Paolo Bonzini 348500
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
0a0d66
index b2a8aeba85..eff6253465 100644
Paolo Bonzini 348500
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
Paolo Bonzini 348500
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
740797
@@ -55,6 +55,7 @@
Paolo Bonzini 348500
   DebugLib
Paolo Bonzini 348500
   PcdLib
Paolo Bonzini 348500
   BaseLib
Paolo Bonzini 348500
+  PrintLib
Paolo Bonzini 348500
 
Paolo Bonzini 348500
 [Guids]
Paolo Bonzini 348500
   ## SOMETIMES_PRODUCES ## Variable:L"ConInDev"
0a0d66
@@ -87,6 +88,7 @@
Paolo Bonzini 348500
 [Pcd]
Paolo Bonzini 348500
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType           ## SOMETIMES_CONSUMES
Paolo Bonzini 348500
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable    ## CONSUMES
Paolo Bonzini 348500
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm             ## CONSUMES
Paolo Bonzini 348500
 
Paolo Bonzini 348500
 # [Event]
Paolo Bonzini 348500
 # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.
59c3cd
-- 
59c3cd
2.27.0
59c3cd