TianoCore EDK2 master
Loading...
Searching...
No Matches
Terminal.c File Reference
#include "Terminal.h"

Go to the source code of this file.

Functions

TERMINAL_TYPE TerminalTypeFromGuid (IN EFI_GUID *Guid)
 
EFI_STATUS EFIAPI TerminalDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS TerminalFreeNotifyList (IN OUT LIST_ENTRY *ListHead)
 
TERMINAL_CONSOLE_MODE_DATAInitializeTerminalConsoleTextMode (OUT INT32 *TextModeCount)
 
VOID StopTerminalStateMachine (TERMINAL_DEV *TerminalDevice)
 
VOID StartTerminalStateMachine (TERMINAL_DEV *TerminalDevice)
 
EFI_STATUS InitializeControllerNameTable (TERMINAL_TYPE TerminalType, EFI_UNICODE_STRING_TABLE **ControllerNameTable)
 
EFI_STATUS EFIAPI TerminalDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI TerminalDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
BOOLEAN MatchDevicePaths (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
 
VOID TerminalUpdateConsoleDevVariable (IN CHAR16 *VariableName, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath)
 
VOID TerminalRemoveConsoleDevVariable (IN CHAR16 *VariableName, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath)
 
EFI_STATUS SetTerminalDevicePath (IN TERMINAL_TYPE TerminalType, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath)
 
EFI_STATUS EFIAPI InitializeTerminal (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
BOOLEAN IsHotPlugDevice (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding
 
EFI_GUIDmTerminalType []
 
CHAR16 * mSerialConsoleNames []
 
TERMINAL_DEV mTerminalDevTemplate
 
TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData []
 

Detailed Description

Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and Simple Text Output Protocol upon Serial IO Protocol.

Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Terminal.c.

Function Documentation

◆ InitializeControllerNameTable()

EFI_STATUS InitializeControllerNameTable ( TERMINAL_TYPE  TerminalType,
EFI_UNICODE_STRING_TABLE **  ControllerNameTable 
)

Initialize the controller name table.

Parameters
TerminalTypeThe terminal type.
ControllerNameTableThe controller name table.
Return values
EFI_SUCCESSThe controller name table is initialized successfully.
othersReturn status of AddUnicodeString2 ().

Definition at line 415 of file Terminal.c.

◆ InitializeTerminal()

EFI_STATUS EFIAPI InitializeTerminal ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The user Entry Point for module Terminal. The user code starts with this function.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
otherSome error occurs when executing this entry point.

Definition at line 1340 of file Terminal.c.

◆ InitializeTerminalConsoleTextMode()

TERMINAL_CONSOLE_MODE_DATA * InitializeTerminalConsoleTextMode ( OUT INT32 *  TextModeCount)

Initialize all the text modes which the terminal console supports.

It returns information for available text modes that the terminal can support.

Parameters
[out]TextModeCountThe total number of text modes that terminal console supports.
Returns
The buffer to the text modes column and row information. Caller is responsible to free it when it's non-NULL.

Definition at line 315 of file Terminal.c.

◆ IsHotPlugDevice()

BOOLEAN IsHotPlugDevice ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

Check if the device supports hot-plug through its device path.

This function could be updated to check more types of Hot Plug devices. Currently, it checks USB and PCCard device.

Parameters
DevicePathPointer to device's device path.
Return values
TRUEThe devcie is a hot-plug device
FALSEThe devcie is not a hot-plug device.

Definition at line 1376 of file Terminal.c.

◆ MatchDevicePaths()

BOOLEAN MatchDevicePaths ( IN EFI_DEVICE_PATH_PROTOCOL Multi,
IN EFI_DEVICE_PATH_PROTOCOL Single 
)

Compare a device path data structure to that of all the nodes of a second device path instance.

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Return values
TRUEIf the Single is contained within Multi.
FALSEThe Single is not match within Multi.

Definition at line 1041 of file Terminal.c.

◆ SetTerminalDevicePath()

EFI_STATUS SetTerminalDevicePath ( IN TERMINAL_TYPE  TerminalType,
IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **  TerminalDevicePath 
)

Build terminal device path according to terminal type.

Parameters
TerminalTypeThe terminal type is PC ANSI, VT100, VT100+ or VT-UTF8.
ParentDevicePathParent device path.
TerminalDevicePathReturned terminal device path, if building successfully.
Return values
EFI_UNSUPPORTEDTerminal does not belong to the supported type.
EFI_OUT_OF_RESOURCESGenerate terminal device path failed.
EFI_SUCCESSBuild terminal device path successfully.

Definition at line 1299 of file Terminal.c.

◆ StartTerminalStateMachine()

VOID StartTerminalStateMachine ( TERMINAL_DEV TerminalDevice)

Start the terminal state machine.

Parameters
TerminalDeviceThe terminal device.

Definition at line 373 of file Terminal.c.

◆ StopTerminalStateMachine()

VOID StopTerminalStateMachine ( TERMINAL_DEV TerminalDevice)

Stop the terminal state machine.

Parameters
TerminalDeviceThe terminal device.

Definition at line 353 of file Terminal.c.

◆ TerminalDriverBindingStart()

EFI_STATUS EFIAPI TerminalDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Start this driver on Controller by opening a Serial IO protocol, reading Device Path, and creating a child handle with a Simple Text In, Simple Text In Ex and Simple Text Out protocol, and device path protocol. And store Console Device Environment Variables.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to bind driver to
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver is added to Controller.
EFI_ALREADY_STARTEDThis driver is already running on Controller.
otherThis driver does not support this device.

Definition at line 470 of file Terminal.c.

◆ TerminalDriverBindingStop()

EFI_STATUS EFIAPI TerminalDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Stop this driver on Controller by closing Simple Text In, Simple Text In Ex, Simple Text Out protocol, and removing parent device path from Console Device Environment Variables.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to stop driver on
NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
ChildHandleBufferList of Child Handles to Stop.
Return values
EFI_SUCCESSThis driver is removed Controller.
otherThis driver could not be removed from this device.

Definition at line 904 of file Terminal.c.

◆ TerminalDriverBindingSupported()

EFI_STATUS EFIAPI TerminalDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Test to see if this driver supports Controller.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to test
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver supports this device.
EFI_ALREADY_STARTEDThis driver is already running on this device.
otherThis driver does not support this device.

Definition at line 161 of file Terminal.c.

◆ TerminalFreeNotifyList()

EFI_STATUS TerminalFreeNotifyList ( IN OUT LIST_ENTRY ListHead)

Free notify functions list.

Parameters
ListHeadThe list head
Return values
EFI_SUCCESSFree the notify list successfully.
EFI_INVALID_PARAMETERListHead is NULL.

Definition at line 279 of file Terminal.c.

◆ TerminalRemoveConsoleDevVariable()

VOID TerminalRemoveConsoleDevVariable ( IN CHAR16 *  VariableName,
IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath 
)

Remove terminal device path from Console Device Environment Variables.

Parameters
VariableNameConsole Device Environment Variables.
ParentDevicePathThe terminal device path to be updated.

Definition at line 1178 of file Terminal.c.

◆ TerminalTypeFromGuid()

TERMINAL_TYPE TerminalTypeFromGuid ( IN EFI_GUID Guid)

Convert the GUID representation of terminal type to enum type.

Parameters
GuidThe GUID representation of terminal type.
Returns
The terminal type in enum type.

Definition at line 131 of file Terminal.c.

◆ TerminalUpdateConsoleDevVariable()

VOID TerminalUpdateConsoleDevVariable ( IN CHAR16 *  VariableName,
IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath 
)

Update terminal device path in Console Device Environment Variables.

Parameters
VariableNameThe Console Device Environment Variable.
ParentDevicePathThe terminal device path to be updated.

Definition at line 1080 of file Terminal.c.

Variable Documentation

◆ gTerminalDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding
Initial value:
= {
0xa,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI TerminalDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: Terminal.c:904
EFI_STATUS EFIAPI TerminalDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Terminal.c:470
EFI_STATUS EFIAPI TerminalDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Terminal.c:161

Definition at line 15 of file Terminal.c.

◆ mSerialConsoleNames

CHAR16* mSerialConsoleNames[]
Initial value:
= {
L"PC-ANSI Serial Console",
L"VT-100 Serial Console",
L"VT-100+ Serial Console",
L"VT-UTF8 Serial Console",
L"Tty Terminal Serial Console",
L"Linux Terminal Serial Console",
L"Xterm R6 Serial Console",
L"VT-400 Serial Console",
L"SCO Terminal Serial Console"
}

Definition at line 36 of file Terminal.c.

◆ mTerminalConsoleModeData

TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[]
Initial value:
= {
{ 80, 25 },
{ 80, 50 },
{ 100, 31 },
}

Definition at line 114 of file Terminal.c.

◆ mTerminalDevTemplate

TERMINAL_DEV mTerminalDevTemplate

Definition at line 48 of file Terminal.c.

◆ mTerminalType

EFI_GUID* mTerminalType[]
Initial value:
= {
&gEfiPcAnsiGuid,
&gEfiVT100Guid,
&gEfiVT100PlusGuid,
&gEfiVTUTF8Guid,
&gEfiTtyTermGuid,
&gEdkiiLinuxTermGuid,
&gEdkiiXtermR6Guid,
&gEdkiiVT400Guid,
&gEdkiiSCOTermGuid
}

Definition at line 24 of file Terminal.c.