Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TerminalDxe: Reduce escape seq delay and make it a PCD #186

Draft
wants to merge 1 commit into
base: dasharo
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TERMINAL_DEV mTerminalDevTemplate = {

NULL, // ControllerNameTable
NULL, // TimerEvent
NULL, // TwoSecondTimeOut
NULL, // EscapeTimeout
INPUT_STATE_DEFAULT,
RESET_STATE_DEFAULT,
{
Expand Down Expand Up @@ -359,7 +359,7 @@ StopTerminalStateMachine (
OriginalTpl = gBS->RaiseTPL (TPL_NOTIFY);

gBS->CloseEvent (TerminalDevice->TimerEvent);
gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
gBS->CloseEvent (TerminalDevice->EscapeTimeout);

gBS->RestoreTPL (OriginalTpl);
}
Expand Down Expand Up @@ -397,7 +397,7 @@ StartTerminalStateMachine (
TPL_CALLBACK,
NULL,
NULL,
&TerminalDevice->TwoSecondTimeOut
&TerminalDevice->EscapeTimeout
);
ASSERT_EFI_ERROR (Status);
}
Expand Down
2 changes: 1 addition & 1 deletion MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ typedef struct {
EFI_KEY_FIFO *EfiKeyFiFoForNotify;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_EVENT TimerEvent;
EFI_EVENT TwoSecondTimeOut;
EFI_EVENT EscapeTimeout;
UINT32 InputState;
UINT32 ResetState;
UINT16 TtyEscapeStr[3];
Expand Down
10 changes: 5 additions & 5 deletions MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ UnicodeToEfiKeyFlushState (
// Cancel the timer.
//
gBS->SetTimer (
TerminalDevice->TwoSecondTimeOut,
TerminalDevice->EscapeTimeout,
TimerCancel,
0
);
Expand Down Expand Up @@ -1345,7 +1345,7 @@ UnicodeToEfiKey (
EFI_INPUT_KEY Key;
BOOLEAN SetDefaultResetState;

TimerStatus = gBS->CheckEvent (TerminalDevice->TwoSecondTimeOut);
TimerStatus = gBS->CheckEvent (TerminalDevice->EscapeTimeout);

if (!EFI_ERROR (TimerStatus)) {
UnicodeToEfiKeyFlushState (TerminalDevice);
Expand All @@ -1357,7 +1357,7 @@ UnicodeToEfiKey (
//
// Check to see if the 2 seconds timer has expired
//
TimerStatus = gBS->CheckEvent (TerminalDevice->TwoSecondTimeOut);
TimerStatus = gBS->CheckEvent (TerminalDevice->EscapeTimeout);
if (!EFI_ERROR (TimerStatus)) {
UnicodeToEfiKeyFlushState (TerminalDevice);
TerminalDevice->ResetState = RESET_STATE_DEFAULT;
Expand Down Expand Up @@ -2092,9 +2092,9 @@ UnicodeToEfiKey (

if (TerminalDevice->InputState != INPUT_STATE_DEFAULT) {
Status = gBS->SetTimer (
TerminalDevice->TwoSecondTimeOut,
TerminalDevice->EscapeTimeout,
TimerRelative,
(UINT64)20000000
PcdGet64 (PcdEscapeTimeout)
);
ASSERT_EFI_ERROR (Status);
continue;
Expand Down
1 change: 1 addition & 0 deletions MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## SOMETIMES_CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdEscapeTimeout ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES

# [Event]
Expand Down
4 changes: 4 additions & 0 deletions MdePkg/MdePkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -2510,5 +2510,9 @@
# @Prompt Memory encryption attribute
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0|UINT64|0x0000002e

## This dynamic PCD configures the escape sequence delay after Escape keypress.
# @Prompt Escape sequence timeout
gEfiMdePkgTokenSpaceGuid.PcdEscapeTimeout|5000000|UINT64|0x0000002f

[UserExtensions.TianoCore."ExtraFiles"]
MdePkgExtra.uni
Loading