MdeModulePkg TerminalDxe: Execute key notify func at TPL_CALLBACK

Current implementation executes key notify function in TimerHandler
at TPL_NOTIFY. The code change is to make key notify function
executed at TPL_CALLBACK to reduce the time occupied at TPL_NOTIFY.

The code will signal KeyNotify process event if the key pressed
matches any key registered and insert the KeyData to the EFI Key
queue for notify, then the KeyNotify process handler will invoke
key notify functions at TPL_CALLBACK.

Cc: Ruiyu Ni <Ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
This commit is contained in:
Star Zeng
2016-12-19 22:21:11 +08:00
parent 4ae46dbacd
commit 47b612db90
3 changed files with 284 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Header file for Terminal driver.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -95,6 +95,7 @@ typedef struct {
RAW_DATA_FIFO *RawFiFo;
UNICODE_FIFO *UnicodeFiFo;
EFI_KEY_FIFO *EfiKeyFiFo;
EFI_KEY_FIFO *EfiKeyFiFoForNotify;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_EVENT TimerEvent;
EFI_EVENT TwoSecondTimeOut;
@@ -113,6 +114,7 @@ typedef struct {
BOOLEAN OutputEscChar;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
LIST_ENTRY NotifyList;
EFI_EVENT KeyNotifyProcessEvent;
} TERMINAL_DEV;
#define INPUT_STATE_DEFAULT 0x00
@@ -941,6 +943,67 @@ IsRawFiFoFull (
TERMINAL_DEV *TerminalDevice
);
/**
Insert one pre-fetched key into the FIFO buffer.
@param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO.
@param Input The key will be input.
@retval TRUE If insert successfully.
@retval FALSE If FIFO buffer is full before key insertion,
and the key is lost.
**/
BOOLEAN
EfiKeyFiFoForNotifyInsertOneKey (
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Input
);
/**
Remove one pre-fetched key out of the FIFO buffer.
@param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO.
@param Output The key will be removed.
@retval TRUE If insert successfully.
@retval FALSE If FIFO buffer is empty before remove operation.
**/
BOOLEAN
EfiKeyFiFoForNotifyRemoveOneKey (
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Output
);
/**
Clarify whether FIFO buffer is empty.
@param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO.
@retval TRUE If FIFO buffer is empty.
@retval FALSE If FIFO buffer is not empty.
**/
BOOLEAN
IsEfiKeyFiFoForNotifyEmpty (
IN EFI_KEY_FIFO *EfiKeyFiFo
);
/**
Clarify whether FIFO buffer is full.
@param EfiKeyFiFo Pointer to instance of EFI_KEY_FIFO.
@retval TRUE If FIFO buffer is full.
@retval FALSE If FIFO buffer is not full.
**/
BOOLEAN
IsEfiKeyFiFoForNotifyFull (
EFI_KEY_FIFO *EfiKeyFiFo
);
/**
Insert one pre-fetched key into the FIFO buffer.
@@ -1360,4 +1423,19 @@ TerminalConInTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
);
/**
Process key notify.
@param Event Indicates the event that invoke this function.
@param Context Indicates the calling context.
**/
VOID
EFIAPI
KeyNotifyProcessHandler (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif