X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FBus%2FIsa%2FPs2KeyboardDxe%2FPs2KbdTextIn.c;h=04e3365f9e6d8533b28c4002c19fb86d257e66d0;hp=f6ccd9598fb0b0e7d98043c85f4a59b891f9d8e8;hb=b4e96b82b4e2e47e95014b51787ba5b43abac784;hpb=4aa68cbc97e06d93a82189ade1317104f95535c1 diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c index f6ccd9598f..04e3365f9e 100644 --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c @@ -2,7 +2,7 @@ Routines implements SIMPLE_TEXT_IN protocol's interfaces based on 8042 interfaces provided by Ps2KbdCtrller.c. -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -533,9 +533,12 @@ Exit: @param This Protocol instance pointer. @param KeyData A pointer to a buffer that is filled in with the keystroke - information data for the key that was pressed. + information data for the key that was pressed. If KeyData.Key, + KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState are 0, + then any incomplete keystroke will trigger a notification of the KeyNotificationFunction. @param KeyNotificationFunction Points to the function to be called when the key - sequence is typed specified by KeyData. + sequence is typed specified by KeyData. This notification function + should be called at <=TPL_CALLBACK. @param NotifyHandle Points to the unique handle assigned to the registered notification. @retval EFI_SUCCESS The notification function was registered successfully. @@ -681,3 +684,52 @@ Exit: return Status; } +/** + 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 + ) +{ + EFI_STATUS Status; + KEYBOARD_CONSOLE_IN_DEV *ConsoleIn; + EFI_KEY_DATA KeyData; + LIST_ENTRY *Link; + LIST_ENTRY *NotifyList; + KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; + EFI_TPL OldTpl; + + ConsoleIn = (KEYBOARD_CONSOLE_IN_DEV *) Context; + + // + // Invoke notification functions. + // + NotifyList = &ConsoleIn->NotifyList; + while (TRUE) { + // + // Enter critical section + // + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + Status = PopEfikeyBufHead (&ConsoleIn->EfiKeyQueueForNotify, &KeyData); + // + // Leave critical section + // + gBS->RestoreTPL (OldTpl); + if (EFI_ERROR (Status)) { + break; + } + for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList, Link); Link = GetNextNode (NotifyList, Link)) { + CurrentNotify = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE); + if (IsKeyRegistered (&CurrentNotify->KeyData, &KeyData)) { + CurrentNotify->KeyNotificationFn (&KeyData); + } + } + } +} +