|
|
9fc821 |
From f337eb3972afcccabe86fe663202a758337d0ab8 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
|
|
|
294170 |
Subject: [PATCH] MdeModulePkg: TerminalDxe: set xterm resolution on mode
|
|
Paolo Bonzini |
7ae6f1 |
change (RH only)
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
The
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
CSI Ps ; Ps ; Ps t
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
escape sequence serves for window manipulation. We can use the
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
CSI 8 ; <rows> ; <columns> t
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
sequence to adapt eg. the xterm window size to the selected console mode.
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
|
|
Paolo Bonzini |
348500 |
|
|
Paolo Bonzini |
348500 |
- refresh commit 519b9751573e against various context changes
|
|
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 |
|
|
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)
|
|
Paolo Bonzini |
7ae6f1 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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
|
|
|
9fc821 |
index 6a6d9660ed..2dc1cf94e2 100644
|
|
Paolo Bonzini |
348500 |
--- a/MdeModulePkg/MdeModulePkg.dec
|
|
Paolo Bonzini |
348500 |
+++ b/MdeModulePkg/MdeModulePkg.dec
|
|
|
9fc821 |
@@ -1936,6 +1936,10 @@
|
|
Paolo Bonzini |
348500 |
# @Prompt The address mask when memory encryption is enabled.
|
|
Paolo Bonzini |
348500 |
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0|UINT64|0x30001047
|
|
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
|
|
|
9fc821 |
index 4d7218e415..295e7641a5 100644
|
|
Paolo Bonzini |
348500 |
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
Paolo Bonzini |
348500 |
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
|
|
Paolo Bonzini |
348500 |
@@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
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 |
//
|
|
Paolo Bonzini |
7ae6f1 |
@@ -86,6 +88,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 |
//
|
|
Paolo Bonzini |
348500 |
@@ -508,6 +520,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
|
|
|
9fc821 |
index 0780296798..bd2ba828a6 100644
|
|
Paolo Bonzini |
348500 |
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
Paolo Bonzini |
348500 |
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
|
Paolo Bonzini |
348500 |
@@ -60,6 +60,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"
|
|
Paolo Bonzini |
348500 |
@@ -88,6 +89,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.
|