From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A42F32112944E for ; Tue, 11 Sep 2018 19:00:24 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 19:00:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,362,1531810800"; d="scan'208";a="72230968" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 11 Sep 2018 18:55:55 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Sep 2018 18:55:55 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.226]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.143]) with mapi id 14.03.0319.002; Wed, 12 Sep 2018 09:55:53 +0800 From: "Zeng, Star" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , "Zeng, Star" Thread-Topic: [patch 3/3] MdeModulePkg: Avoid key notification called more than once Thread-Index: AQHUSNWyimbOO6/qvECl7NO3uWGLa6Tr49Lg Date: Wed, 12 Sep 2018 01:55:52 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BBB7DDE@shsmsx102.ccr.corp.intel.com> References: <20180910071202.11008-1-dandan.bi@intel.com> <20180910071202.11008-3-dandan.bi@intel.com> In-Reply-To: <20180910071202.11008-3-dandan.bi@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 3/3] MdeModulePkg: Avoid key notification called more than once X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2018 02:00:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Bi, Dandan=20 Sent: Monday, September 10, 2018 3:12 PM To: edk2-devel@lists.01.org Cc: Bi, Dandan ; Ni, Ruiyu ; Zeng,= Star Subject: [patch 3/3] MdeModulePkg: Avoid key notification called more than = once From: Dandan Bi REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D996 Issue: In current code logic, when a key is pressed, it will search the whole Noti= fyList to find whether a notification has been registered with the keystrok= e. if yes, it will en-queue the key for notification execution later. And n= ow if different notification functions have been registered with the same k= ey, then the key will be en-queued more than once. Then it will cause the n= otification executed more than once. This patch is to enhance the code logic to fix this issue. Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- 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/MdeModul= ePkg/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; } } =20 PushEfikeyBufTail (&ConsoleIn->EfiKeyQueue, &KeyData); } diff --git a/M= deModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c b/MdeModulePkg/Bus/Usb/UsbKbDxe/Key= Board.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; } } =20 return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/M= deModulePkg/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