MdeModulePkg: Fix TerminalDxe FIFO Data Loss

Fixes a Terminal FIFO full issue that caused data to be lost. The Unicode and EFI Key FIFOs are now checked to make sure they have spaces before pushing another entry.

Signed-off-by: eugenecohen
Reviewed-by: niruiyu

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12512 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2011-10-08 02:09:50 +00:00
parent f32df6f658
commit 02b7bcf9ce
3 changed files with 1978 additions and 1976 deletions

View File

@ -34,7 +34,7 @@ AnsiRawDataToUnicode (
// and translate it into unicode, then push // and translate it into unicode, then push
// the unicode into unicode fifo, until the raw fifo is empty. // the unicode into unicode fifo, until the raw fifo is empty.
// //
while (!IsRawFiFoEmpty (TerminalDevice)) { while (!IsRawFiFoEmpty (TerminalDevice) && !IsUnicodeFiFoFull(TerminalDevice) ) {
RawFiFoRemoveOneKey (TerminalDevice, &RawData); RawFiFoRemoveOneKey (TerminalDevice, &RawData);

View File

@ -563,7 +563,7 @@ TerminalConInTimerHandler (
// Fetch all the keys in the serial buffer, // Fetch all the keys in the serial buffer,
// and insert the byte stream into RawFIFO. // and insert the byte stream into RawFIFO.
// //
do { while( !IsRawFiFoFull(TerminalDevice) ) {
Status = GetOneKeyFromSerial (TerminalDevice->SerialIo, &Input); Status = GetOneKeyFromSerial (TerminalDevice->SerialIo, &Input);
@ -579,7 +579,7 @@ TerminalConInTimerHandler (
} }
RawFiFoInsertOneKey (TerminalDevice, Input); RawFiFoInsertOneKey (TerminalDevice, Input);
} while (TRUE); }
// //
// Translate all the raw data in RawFIFO into EFI Key, // Translate all the raw data in RawFIFO into EFI Key,
@ -1061,6 +1061,8 @@ UnicodeToEfiKeyFlushState (
InputState = TerminalDevice->InputState; InputState = TerminalDevice->InputState;
if( IsEfiKeyFiFoFull(TerminalDevice) ) return;
if ((InputState & INPUT_STATE_ESC) != 0) { if ((InputState & INPUT_STATE_ESC) != 0) {
Key.ScanCode = SCAN_ESC; Key.ScanCode = SCAN_ESC;
Key.UnicodeChar = 0; Key.UnicodeChar = 0;
@ -1189,7 +1191,7 @@ UnicodeToEfiKey (
TerminalDevice->ResetState = RESET_STATE_DEFAULT; TerminalDevice->ResetState = RESET_STATE_DEFAULT;
} }
while (!IsUnicodeFiFoEmpty(TerminalDevice)) { while (!IsUnicodeFiFoEmpty(TerminalDevice) && !IsEfiKeyFiFoFull(TerminalDevice) ) {
if (TerminalDevice->InputState != INPUT_STATE_DEFAULT) { if (TerminalDevice->InputState != INPUT_STATE_DEFAULT) {
// //

View File

@ -36,7 +36,7 @@ VTUTF8RawDataToUnicode (
// and translate it into unicode, then push // and translate it into unicode, then push
// the unicode into unicode fifo, until the raw fifo is empty. // the unicode into unicode fifo, until the raw fifo is empty.
// //
while (!IsRawFiFoEmpty (TerminalDevice)) { while (!IsRawFiFoEmpty (TerminalDevice) && !IsUnicodeFiFoFull(TerminalDevice) ) {
GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes); GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);