From patchwork Mon Jul 6 23:04:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 50797 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE1F7229FC for ; Mon, 6 Jul 2015 23:05:18 +0000 (UTC) Received: by wgfk9 with SMTP id k9sf54810757wgf.1 for ; Mon, 06 Jul 2015 16:05:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=UfAoXO+0qsPagiTqeJzaULoVnVA1y/dIf7M6zwKAsGU=; b=JX/WEnyWX3/qdNPP4ZueqPUFjIeUVRAQXcIHZRRjHUuJlQ6pI6ZVQliHLhCPjNCOmK uvvWX7OM9V3wPmSn5o8LmtijW9WgMdo9tofTLIYQwN0xJIhBZkuWPs6YA6nIAONgif4e cCcHjJO0svQpJ9JoFs+n7E0AlpY2U/11Kx9DaVqYHZKSxIEprH7caJrh7+agIVIUDaV0 xUUijt6iVErFYH7cO3cBMb6mIjecuzP0QCoD8GOJLf4IJQsAq0540XtNDr5GUznUtaLp B4jR4L+nYFb8a73wZPHpaXDGcpE80G+AZ5Ti416ELeRsjifVSYU5H/OWIZZVndhJqIaD +R7Q== X-Gm-Message-State: ALoCoQnKEAmOA8abjmbQMEvHPBK9yCi0LXzMkodDkjFwMGa9gt0ProE7ubq9QwHP6XjpzfFTLASU X-Received: by 10.112.188.233 with SMTP id gd9mr580665lbc.12.1436223918315; Mon, 06 Jul 2015 16:05:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.2 with SMTP id ls2ls747057lac.51.gmail; Mon, 06 Jul 2015 16:05:18 -0700 (PDT) X-Received: by 10.112.186.35 with SMTP id fh3mr1156767lbc.82.1436223918116; Mon, 06 Jul 2015 16:05:18 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id l1si16482596lal.56.2015.07.06.16.05.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 16:05:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lagc2 with SMTP id c2so172710721lag.3 for ; Mon, 06 Jul 2015 16:05:17 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr1162153lbp.88.1436223917661; Mon, 06 Jul 2015 16:05:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2009576lbb; Mon, 6 Jul 2015 16:05:16 -0700 (PDT) X-Received: by 10.107.6.105 with SMTP id 102mr1715187iog.35.1436223914847; Mon, 06 Jul 2015 16:05:14 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id v103si18118725iov.51.2015.07.06.16.05.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 16:05:14 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCFRe-0000Z8-Oc; Mon, 06 Jul 2015 23:05:02 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCFRd-0000Z2-Hn for edk2-devel@lists.sourceforge.net; Mon, 06 Jul 2015 23:05:01 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.192.175 as permitted sender) client-ip=209.85.192.175; envelope-from=roy.franz@linaro.org; helo=mail-pd0-f175.google.com; Received: from mail-pd0-f175.google.com ([209.85.192.175]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1ZCFRc-0003KN-5D for edk2-devel@lists.sourceforge.net; Mon, 06 Jul 2015 23:05:01 +0000 Received: by pddu5 with SMTP id u5so26030841pdd.3 for ; Mon, 06 Jul 2015 16:04:54 -0700 (PDT) X-Received: by 10.70.130.3 with SMTP id oa3mr2268526pdb.51.1436223894487; Mon, 06 Jul 2015 16:04:54 -0700 (PDT) Received: from localhost.localdomain (c-73-41-93-56.hsd1.ca.comcast.net. [73.41.93.56]) by mx.google.com with ESMTPSA id m2sm19544337pdp.4.2015.07.06.16.04.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 16:04:53 -0700 (PDT) From: Roy Franz To: edk2-devel@lists.sourceforge.net, feng.tian@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org Date: Mon, 6 Jul 2015 16:04:36 -0700 Message-Id: <1436223879-27956-2-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436223879-27956-1-git-send-email-roy.franz@linaro.org> References: <1436223879-27956-1-git-send-email-roy.franz@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1ZCFRc-0003KN-5D Subject: [edk2] [PATCH V2 1/4] Add "TtyTerm" terminal type to TerminalDxe X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- MdeModulePkg/Include/Guid/TtyTerm.h | 25 +++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 ++ MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c | 44 ++++++++++++++++---- MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h | 2 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 4 +- MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c | 2 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf | 1 + 7 files changed, 73 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Include/Guid/TtyTerm.h b/MdeModulePkg/Include/Guid/TtyTerm.h new file mode 100644 index 0000000..900e5af --- /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 414b13e..539463b 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -304,6 +304,9 @@ # Include/Guid/LzmaDecompress.h 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/Guid/TtyTerm.h + gEfiTtyTermGuid = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }} [Ppis] ## Include/Ppi/AtaController.h diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 966fb79..babb097 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 d393acb..03542a4 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 4a008c9..17a1244 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 affb3ae..9fa952a 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 1d86388..0780296 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]