Reviewed-by: Star Zeng <star.z...@intel.com> -----Original Message----- From: Bi, Dandan Sent: Monday, September 10, 2018 3:12 PM To: edk2-devel@lists.01.org Cc: Bi, Dandan <dandan...@intel.com>; Ni, Ruiyu <ruiyu...@intel.com>; Zeng, Star <star.z...@intel.com> Subject: [patch 3/3] MdeModulePkg: Avoid key notification called more than once
From: Dandan Bi <dandan...@intel.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=996 Issue: In current code logic, when a key is pressed, it will search the whole NotifyList to find whether a notification has been registered with the keystroke. if yes, it will en-queue the key for notification execution later. And now if different notification functions have been registered with the same key, then the key will be en-queued more than once. Then it will cause the notification executed more than once. This patch is to enhance the code logic to fix this issue. Cc: Ruiyu Ni <ruiyu...@intel.com> Cc: Star Zeng <star.z...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan...@intel.com> --- MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 1 + MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 1 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 1 + 3 files changed, 3 insertions(+) diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c index 2ee293d64d..53cb6f0b48 100644 --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c @@ -1449,10 +1449,11 @@ KeyGetchar ( // while current TPL is TPL_NOTIFY. It will be invoked in // KeyNotifyProcessHandler() which runs at TPL_CALLBACK. // PushEfikeyBufTail (&ConsoleIn->EfiKeyQueueForNotify, &KeyData); gBS->SignalEvent (ConsoleIn->KeyNotifyProcessEvent); + break; } } PushEfikeyBufTail (&ConsoleIn->EfiKeyQueue, &KeyData); } diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c index b3b5fb9ff4..9cb4b5db6b 100644 --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c @@ -1693,10 +1693,11 @@ UsbKeyCodeToEfiInputKey ( // while current TPL is TPL_NOTIFY. It will be invoked in // KeyNotifyProcessHandler() which runs at TPL_CALLBACK. // Enqueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, KeyData, sizeof (*KeyData)); gBS->SignalEvent (UsbKeyboardDevice->KeyNotifyProcessEvent); + break; } } return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 33f9b6e585..d681a3039e 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -985,10 +985,11 @@ EfiKeyFiFoInsertOneKey ( // while current TPL is TPL_NOTIFY. It will be invoked in // KeyNotifyProcessHandler() which runs at TPL_CALLBACK. // EfiKeyFiFoForNotifyInsertOneKey (TerminalDevice->EfiKeyFiFoForNotify, Key); gBS->SignalEvent (TerminalDevice->KeyNotifyProcessEvent); + break; } } if (IsEfiKeyFiFoFull (TerminalDevice)) { // // Efi Key FIFO is full -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel