\r
InitQueue (&UsbKeyboardDevice->UsbKeyQueue, sizeof (USB_KEY));\r
InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA));\r
+ InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));\r
\r
//\r
// Use the config out of the descriptor\r
KeyData->KeyState.KeyToggleState |= EFI_KEY_STATE_EXPOSED;\r
}\r
//\r
- // Invoke notification functions if the key is registered.\r
+ // Signal KeyNotify process event if this key pressed matches any key registered.\r
//\r
NotifyList = &UsbKeyboardDevice->NotifyList;\r
for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList, Link); Link = GetNextNode (NotifyList, Link)) {\r
CurrentNotify = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);\r
if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
- CurrentNotify->KeyNotificationFn (KeyData);\r
+ //\r
+ // The key notification function needs to run at TPL_CALLBACK\r
+ // while current TPL is TPL_NOTIFY. It will be invoked in\r
+ // KeyNotifyProcessHandler() which runs at TPL_CALLBACK.\r
+ //\r
+ Enqueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, KeyData, sizeof (*KeyData));\r
+ gBS->SignalEvent (UsbKeyboardDevice->KeyNotifyProcessEvent);\r
}\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
Create the queue.\r
\r