summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 05:38:42 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 05:38:42 +0000
commit59d88f42ca8b2d1556e52930a164f908814b9b9e (patch)
tree8b17adfabdc9609e67433114e7eff14a99054772 /MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
parentbdfbe63efacf2c0feb9ce4486d7d703a7da948ff (diff)
downloadedk2-59d88f42ca8b2d1556e52930a164f908814b9b9e.tar.gz
edk2-59d88f42ca8b2d1556e52930a164f908814b9b9e.tar.bz2
edk2-59d88f42ca8b2d1556e52930a164f908814b9b9e.zip
Check the serial buffer empty status before performing the serial IO reading operation.
Signed-off-by: niruiyu Reviewed-by: vanjeff git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12581 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c')
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
index 47881a9d9c..90bac164bc 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
@@ -515,6 +515,7 @@ TerminalConInTimerHandler (
{
EFI_STATUS Status;
TERMINAL_DEV *TerminalDevice;
+ UINT32 Control;
UINT8 Input;
EFI_SERIAL_IO_MODE *Mode;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
@@ -558,27 +559,33 @@ TerminalConInTimerHandler (
TerminalDevice->SerialInTimeOut = SerialInTimeOut;
}
}
-
//
- // Fetch all the keys in the serial buffer,
- // and insert the byte stream into RawFIFO.
+ // Check whether serial buffer is empty.
//
- while (!IsRawFiFoFull (TerminalDevice)) {
+ Status = SerialIo->GetControl (SerialIo, &Control);
- Status = GetOneKeyFromSerial (TerminalDevice->SerialIo, &Input);
+ if ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) == 0) {
+ //
+ // Fetch all the keys in the serial buffer,
+ // and insert the byte stream into RawFIFO.
+ //
+ while (!IsRawFiFoFull (TerminalDevice)) {
- if (EFI_ERROR (Status)) {
- if (Status == EFI_DEVICE_ERROR) {
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR),
- TerminalDevice->DevicePath
- );
+ Status = GetOneKeyFromSerial (TerminalDevice->SerialIo, &Input);
+
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_DEVICE_ERROR) {
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+ EFI_ERROR_CODE | EFI_ERROR_MINOR,
+ (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR),
+ TerminalDevice->DevicePath
+ );
+ }
+ break;
}
- break;
- }
- RawFiFoInsertOneKey (TerminalDevice, Input);
+ RawFiFoInsertOneKey (TerminalDevice, Input);
+ }
}
//