From 6e3227c88c0a53df0a963628b1110f7d39e89883 Mon Sep 17 00:00:00 2001 From: Roy Franz Date: Thu, 9 Jul 2015 06:24:11 +0000 Subject: Add "TtyTerm" terminal type to TerminalDxe This patch a adds new terminal type, TtyTerm, to TerminalDxe. This terminal type provides a place to add support for various *nix terminals that don't behave like standard VT terminals. The goal is to 'just work' with as many terminals as possible, rather than properly emulating any one specific terminal. Signed-off-by: Roy Franz Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Ard Biesheuvel Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17895 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Include/Guid/TtyTerm.h | 25 ++++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 ++ .../Universal/Console/TerminalDxe/Terminal.c | 44 ++++++++++++++++++---- .../Universal/Console/TerminalDxe/Terminal.h | 2 + .../Universal/Console/TerminalDxe/TerminalConIn.c | 4 +- .../Universal/Console/TerminalDxe/TerminalConOut.c | 2 + .../Universal/Console/TerminalDxe/TerminalDxe.inf | 1 + 7 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 MdeModulePkg/Include/Guid/TtyTerm.h diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h new file mode 100644 index 0000000000..900e5af892 --- /dev/null +++ b/MdeModulePkg/Include/Guid/TtyTerm.h @@ -0,0 +1,25 @@ +/** @file +GUID definition for TtyTerm terminal type. The TtyTerm terminal aims to +provide support for modern *nix terminals. + + +Copyright (c) 2015 Linaro Ltd. +This program and the accompanying materials are licensed and made +available under the terms and conditions of the BSD License that +accompanies this distribution. The full text of the license may be found +at http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __TTYTERM_H__ +#define __TTYTERM_H__ + +#define EFI_TTY_TERM_GUID \ + {0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } } + +extern EFI_GUID gEfiTtyTermGuid; + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index c48669d67a..b5acce1dbe 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -308,6 +308,9 @@ gLzmaCustomDecompressGuid = { 0xEE4E5898, 0x3914, 0x4259, { 0x9D, 0x6E, 0xDC, 0x7B, 0xD7, 0x94, 0x03, 0xCF }} gLzmaF86CustomDecompressGuid = { 0xD42AE6BD, 0x1352, 0x4bfb, { 0x90, 0x9A, 0xCA, 0x72, 0xA6, 0xEA, 0xE8, 0x89 }} + ## Include/Guid/TtyTerm.h + gEfiTtyTermGuid = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }} + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 966fb79ce4..babb097e57 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -33,7 +33,8 @@ EFI_GUID *gTerminalType[] = { &gEfiPcAnsiGuid, &gEfiVT100Guid, &gEfiVT100PlusGuid, - &gEfiVTUTF8Guid + &gEfiVTUTF8Guid, + &gEfiTtyTermGuid }; @@ -152,12 +153,13 @@ TerminalDriverBindingSupported ( } // - // only supports PC ANSI, VT100, VT100+ and VT-UTF8 terminal types + // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal types // if (!CompareGuid (&Node->Guid, &gEfiPcAnsiGuid) && !CompareGuid (&Node->Guid, &gEfiVT100Guid) && !CompareGuid (&Node->Guid, &gEfiVT100PlusGuid) && - !CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) { + !CompareGuid (&Node->Guid, &gEfiVTUTF8Guid) && + !CompareGuid (&Node->Guid, &gEfiTtyTermGuid)) { return EFI_UNSUPPORTED; } @@ -275,6 +277,10 @@ BuildTerminalDevpath ( TerminalType = VTUTF8TYPE; + } else if (CompareGuid (&Node->Guid, &gEfiTtyTermGuid)) { + + TerminalType = TTYTERMTYPE; + } else { return NULL; } @@ -708,9 +714,9 @@ TerminalDriverBindingStart ( TerminalType = PcdGet8 (PcdDefaultTerminalType); // - // Must be between PCANSITYPE (0) and VTUTF8TYPE (3) + // Must be between PCANSITYPE (0) and TTYTERMTYPE (4) // - ASSERT (TerminalType <= VTUTF8TYPE); + ASSERT (TerminalType <= TTYTERMTYPE); CopyMem (&DefaultNode->Guid, gTerminalType[TerminalType], sizeof (EFI_GUID)); RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DefaultNode; @@ -728,6 +734,8 @@ TerminalDriverBindingStart ( TerminalType = VT100PLUSTYPE; } else if (CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) { TerminalType = VTUTF8TYPE; + } else if (CompareGuid (&Node->Guid, &gEfiTtyTermGuid)) { + TerminalType = TTYTERMTYPE; } else { goto Error; } @@ -926,6 +934,24 @@ TerminalDriverBindingStart ( ); break; + + case TTYTERMTYPE: + AddUnicodeString2 ( + "eng", + gTerminalComponentName.SupportedLanguages, + &TerminalDevice->ControllerNameTable, + (CHAR16 *)L"Tty Terminal Serial Console", + TRUE + ); + AddUnicodeString2 ( + "en", + gTerminalComponentName2.SupportedLanguages, + &TerminalDevice->ControllerNameTable, + (CHAR16 *)L"Tty Terminal Serial Console", + FALSE + ); + + break; } // @@ -1441,7 +1467,7 @@ TerminalUpdateConsoleDevVariable ( // // Append terminal device path onto the variable. // - for (TerminalType = PCANSITYPE; TerminalType <= VTUTF8TYPE; TerminalType++) { + for (TerminalType = PCANSITYPE; TerminalType <= TTYTERMTYPE; TerminalType++) { SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath); NewVariable = AppendDevicePathInstance (Variable, TempDevicePath); ASSERT (NewVariable != NULL); @@ -1554,7 +1580,7 @@ TerminalRemoveConsoleDevVariable ( // Loop through all the terminal types that this driver supports // Match = FALSE; - for (TerminalType = PCANSITYPE; TerminalType <= VTUTF8TYPE; TerminalType++) { + for (TerminalType = PCANSITYPE; TerminalType <= TTYTERMTYPE; TerminalType++) { SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath); @@ -1658,6 +1684,10 @@ SetTerminalDevicePath ( CopyGuid (&Node.Guid, &gEfiVTUTF8Guid); break; + case TTYTERMTYPE: + CopyGuid (&Node.Guid, &gEfiTtyTermGuid); + break; + default: return EFI_UNSUPPORTED; } diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index d393acbc20..03542a40dc 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include #include #include @@ -136,6 +137,7 @@ typedef union { #define VT100TYPE 1 #define VT100PLUSTYPE 2 #define VTUTF8TYPE 3 +#define TTYTERMTYPE 4 #define LEFTOPENBRACKET 0x5b // '[' #define ACAP 0x41 diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 4a008c9ada..17a1244349 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -454,6 +454,7 @@ TranslateRawDataToEfiKey ( case PCANSITYPE: case VT100TYPE: case VT100PLUSTYPE: + case TTYTERMTYPE: AnsiRawDataToUnicode (TerminalDevice); UnicodeToEfiKey (TerminalDevice); break; @@ -1393,7 +1394,8 @@ UnicodeToEfiKey ( if (TerminalDevice->TerminalType == PCANSITYPE || TerminalDevice->TerminalType == VT100TYPE || TerminalDevice->TerminalType == VT100PLUSTYPE || - TerminalDevice->TerminalType == VTUTF8TYPE) { + TerminalDevice->TerminalType == VTUTF8TYPE || + TerminalDevice->TerminalType == TTYTERMTYPE) { switch (UnicodeChar) { case 'A': Key.ScanCode = SCAN_UP; diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c index affb3ae8e1..9fa952ad2a 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c @@ -223,6 +223,7 @@ TerminalConOutOutputString ( case PCANSITYPE: case VT100TYPE: case VT100PLUSTYPE: + case TTYTERMTYPE: if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) { // @@ -371,6 +372,7 @@ TerminalConOutTestString ( case PCANSITYPE: case VT100TYPE: case VT100PLUSTYPE: + case TTYTERMTYPE: Status = AnsiTestString (TerminalDevice, WString); break; diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf index 1d863881ac..0780296798 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf @@ -73,6 +73,7 @@ gEfiVT100Guid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEfiVT100PlusGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEfiPcAnsiGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path + gEfiTtyTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## GUID [Protocols] -- cgit v1.2.3