@@ -38,6 +38,11 @@
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
}
+#define EFI_LINUX_TERM_GUID \
+ { \
+ 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } \
+ }
+
#define EFI_UART_DEVICE_PATH_GUID \
{ \
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
@@ -52,6 +57,7 @@ extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
+extern EFI_GUID gEfiLinuxTermGuid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
@@ -27,8 +27,10 @@ EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;
EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID;
EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;
EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;
+EFI_GUID gEfiLinuxTermGuid = EFI_LINUX_TERM_GUID;
EFI_GUID_STRING(&gEfiPcAnsiGuid, "Efi", "Efi PC ANSI Device Path Vendor GUID")
EFI_GUID_STRING(&gEfiVT100Guid, "Efi", "Efi VT100 Device Path Vendor GUID")
EFI_GUID_STRING(&gEfiVT100PlusGuid, "Efi", "Efi VT100Plus Device Path Vendor GUID")
EFI_GUID_STRING(&gEfiVTUTF8Guid, "Efi", "Efi VTUTF8 Device Path Vendor GUID")
+EFI_GUID_STRING(&gEfiLinuxTermGuid, "Efi", "Efi Linux Terminal Device Path Vendor GUID")
@@ -42,9 +42,15 @@ Abstract:
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} \
}
+#define EFI_LINUX_TERM_GUID \
+ { \
+ 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } \
+ }
+
extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
+extern EFI_GUID gEfiLinuxTermGuid;
#endif
@@ -1657,7 +1657,7 @@ extern COM_ATTR BaudRateList[19];
extern COM_ATTR DataBitsList[4];
extern COM_ATTR ParityList[5];
extern COM_ATTR StopBitsList[3];
-extern EFI_GUID TerminalTypeGuid[4];
+extern EFI_GUID TerminalTypeGuid[5];
extern STRING_DEPOSITORY *FileOptionStrDepository;
extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
extern STRING_DEPOSITORY *BootOptionStrDepository;
@@ -324,9 +324,10 @@ COM_ATTR StopBitsList[3] = {
///
/// Guid for messaging path, used in Serial port setting.
///
-EFI_GUID TerminalTypeGuid[4] = {
+EFI_GUID TerminalTypeGuid[5] = {
DEVICE_PATH_MESSAGING_PC_ANSI,
DEVICE_PATH_MESSAGING_VT_100,
DEVICE_PATH_MESSAGING_VT_100_PLUS,
- DEVICE_PATH_MESSAGING_VT_UTF8
+ DEVICE_PATH_MESSAGING_VT_UTF8,
+ DEVICE_PATH_MESSAGING_LINUX_TERM
};
@@ -33,7 +33,8 @@ EFI_GUID *gTerminalType[] = {
&gEfiPcAnsiGuid,
&gEfiVT100Guid,
&gEfiVT100PlusGuid,
- &gEfiVTUTF8Guid
+ &gEfiVTUTF8Guid,
+ &gEfiLinuxTermGuid
};
@@ -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 Linux 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, &gEfiLinuxTermGuid)) {
return EFI_UNSUPPORTED;
}
@@ -275,6 +277,10 @@ BuildTerminalDevpath (
TerminalType = VTUTF8TYPE;
+ } else if (CompareGuid (&Node->Guid, &gEfiLinuxTermGuid)) {
+
+ TerminalType = LINUXTERMTYPE;
+
} 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 LINUXTERMTYPE (4)
//
- ASSERT (TerminalType <= VTUTF8TYPE);
+ ASSERT (TerminalType <= LINUXTERMTYPE);
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, &gEfiLinuxTermGuid)) {
+ TerminalType = LINUXTERMTYPE;
} else {
goto Error;
}
@@ -926,6 +934,24 @@ TerminalDriverBindingStart (
);
break;
+
+ case LINUXTERMTYPE:
+ AddUnicodeString2 (
+ "eng",
+ gTerminalComponentName.SupportedLanguages,
+ &TerminalDevice->ControllerNameTable,
+ (CHAR16 *)L"Linux Terminal Serial Console",
+ TRUE
+ );
+ AddUnicodeString2 (
+ "en",
+ gTerminalComponentName2.SupportedLanguages,
+ &TerminalDevice->ControllerNameTable,
+ (CHAR16 *)L"Linux 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 <= LINUXTERMTYPE; 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 <= LINUXTERMTYPE; TerminalType++) {
SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
@@ -1658,6 +1684,10 @@ SetTerminalDevicePath (
CopyGuid (&Node.Guid, &gEfiVTUTF8Guid);
break;
+ case LINUXTERMTYPE:
+ CopyGuid (&Node.Guid, &gEfiLinuxTermGuid);
+ break;
+
default:
return EFI_UNSUPPORTED;
}
@@ -136,6 +136,7 @@ typedef union {
#define VT100TYPE 1
#define VT100PLUSTYPE 2
#define VTUTF8TYPE 3
+#define LINUXTERMTYPE 4
#define LEFTOPENBRACKET 0x5b // '['
#define ACAP 0x41
@@ -454,6 +454,7 @@ TranslateRawDataToEfiKey (
case PCANSITYPE:
case VT100TYPE:
case VT100PLUSTYPE:
+ case LINUXTERMTYPE:
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 == LINUXTERMTYPE) {
switch (UnicodeChar) {
case 'A':
Key.ScanCode = SCAN_UP;
@@ -223,6 +223,7 @@ TerminalConOutOutputString (
case PCANSITYPE:
case VT100TYPE:
case VT100PLUSTYPE:
+ case LINUXTERMTYPE:
if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
//
@@ -371,6 +372,7 @@ TerminalConOutTestString (
case PCANSITYPE:
case VT100TYPE:
case VT100PLUSTYPE:
+ case LINUXTERMTYPE:
Status = AnsiTestString (TerminalDevice, WString);
break;
@@ -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
+ gEfiLinuxTermGuid ## SOMETIMES_CONSUMES ## GUID # used with a Vendor-Defined Messaging Device Path
gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## GUID
[Protocols]
@@ -38,6 +38,11 @@
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
}
+#define EFI_LINUX_TERM_GUID \
+ { \
+ 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 } \
+ }
+
#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL \
{ \
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
@@ -52,6 +57,7 @@ extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
+extern EFI_GUID gEfiLinuxTermGuid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
@@ -706,6 +706,7 @@ typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;
#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
+#define DEVICE_PATH_MESSAGING_LINUX_TERM EFI_LINUX_TERM_GUID
///
/// A new device path node is defined to declare flow control characteristics.
@@ -1545,6 +1545,32 @@ DevPathFromTextVenUtf8 (
}
/**
+ Converts a text device path node to Vendor defined Linux terminal device
+ path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor defined Linux terminal
+ device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenLinuxTerm (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ CopyGuid (&Vendor->Guid, &gEfiLinuxTermGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
Converts a text device path node to UART Flow Control device path structure.
@param TextDeviceNode The input Text device path node.
@@ -3075,6 +3101,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
{L"VenVt100", DevPathFromTextVenVt100 },
{L"VenVt100Plus", DevPathFromTextVenVt100Plus },
{L"VenUtf8", DevPathFromTextVenUtf8 },
+ {L"VenLinuxTerm", DevPathFromTextVenLinuxTerm },
{L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
{L"SAS", DevPathFromTextSAS },
{L"SasEx", DevPathFromTextSasEx },
@@ -194,6 +194,9 @@ DevPathToTextVendor (
} else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
UefiDevicePathLibCatPrint (Str, L"VenUft8()");
return ;
+ } else if (CompareGuid (&Vendor->Guid, &gEfiLinuxTermGuid)) {
+ UefiDevicePathLibCatPrint (Str, L"VenLinuxTerm()");
+ return ;
} else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
switch (FlowControlMap & 0x00000003) {
@@ -58,6 +58,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
+ gEfiLinuxTermGuid
+ ## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
@@ -62,6 +62,8 @@
## SOMETIMES_CONSUMES ## GUID
gEfiPcAnsiGuid
## SOMETIMES_CONSUMES ## GUID
+ gEfiLinuxTermGuid
+ ## SOMETIMES_CONSUMES ## GUID
gEfiUartDevicePathGuid
## SOMETIMES_CONSUMES ## GUID
gEfiSasDevicePathGuid
@@ -78,4 +80,4 @@
[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
gEfiDevicePathUtilitiesProtocolGuid
-
\ No newline at end of file
+
@@ -269,6 +269,9 @@
gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }}
## Include/Guid/PcAnsi.h
+ gEfiLinuxTermGuid = { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
+
+ ## Include/Guid/PcAnsi.h
gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }}
## Include/Guid/PcAnsi.h
@@ -848,6 +848,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
{STRING_TOKEN(STR_DEVICE_PATH_VT100), &gEfiVT100Guid, NULL},
{STRING_TOKEN(STR_DEVICE_PATH_VT100P), &gEfiVT100PlusGuid, NULL},
{STRING_TOKEN(STR_DEVICE_PATH_VTUTF8), &gEfiVTUTF8Guid, NULL},
+ {STRING_TOKEN(STR_DEVICE_PATH_LINUXTERM), &gEfiLinuxTermGuid, NULL},
{STRING_TOKEN(STR_DRIVER_BINDING), &gEfiDriverBindingProtocolGuid, NULL},
{STRING_TOKEN(STR_PLATFORM_OVERRIDE), &gEfiPlatformDriverOverrideProtocolGuid, NULL},
{STRING_TOKEN(STR_BUS_OVERRIDE), &gEfiBusSpecificDriverOverrideProtocolGuid, NULL},
@@ -181,6 +181,7 @@
gEfiVT100Guid ##UNDEFINED
gEfiVT100PlusGuid ##UNDEFINED
gEfiVTUTF8Guid ##UNDEFINED
+ gEfiLinuxTermGuid ##UNDEFINED
gEfiStandardErrorDeviceGuid ##UNDEFINED
gEfiConsoleInDeviceGuid ##UNDEFINED
gEfiConsoleOutDeviceGuid ##UNDEFINED
This patch adds new terminal type, LinuxTerm, to TerminalDxe. This terminal type provides a place to add support for various Linux terminals that don't behave like standard VT terminals. Signed-off-by: Roy Franz <roy.franz@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 --- BaseTools/Source/C/Include/Guid/PcAnsi.h | 6 +++ .../Foundation/Efi/Guid/PcAnsi/PcAnsi.c | 2 + .../Foundation/Efi/Guid/PcAnsi/PcAnsi.h | 6 +++ .../Universal/BdsDxe/BootMaint/BootMaint.h | 2 +- .../Universal/BdsDxe/BootMaint/Data.c | 5 ++- .../Universal/Console/TerminalDxe/Terminal.c | 44 ++++++++++++++++++---- .../Universal/Console/TerminalDxe/Terminal.h | 1 + .../Universal/Console/TerminalDxe/TerminalConIn.c | 4 +- .../Universal/Console/TerminalDxe/TerminalConOut.c | 2 + .../Universal/Console/TerminalDxe/TerminalDxe.inf | 1 + MdePkg/Include/Guid/PcAnsi.h | 6 +++ MdePkg/Include/Protocol/DevicePath.h | 1 + .../Library/UefiDevicePathLib/DevicePathFromText.c | 27 +++++++++++++ .../Library/UefiDevicePathLib/DevicePathToText.c | 3 ++ .../UefiDevicePathLib/UefiDevicePathLib.inf | 2 + ...UefiDevicePathLibOptionalDevicePathProtocol.inf | 4 +- MdePkg/MdePkg.dec | 3 ++ .../UefiHandleParsingLib/UefiHandleParsingLib.c | 1 + .../UefiHandleParsingLib/UefiHandleParsingLib.inf | 1 + 19 files changed, 109 insertions(+), 12 deletions(-)