]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c
IntelFrameworkModulePkg Ps2KbDxe: Execute key notify func at TPL_CALLBACK
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.c
index b6a9b70ca95af88195016f3512db95ff068e05f0..ff562b2698d65fa1b9fe718d70dc71548a35678a 100644 (file)
@@ -3,7 +3,7 @@
   PS/2 Keyboard driver. Routines that interacts with callers,\r
   conforming to EFI driver model\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -306,6 +306,7 @@ KbdControllerDriverStart (
     StatusCode  = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;\r
     goto ErrorExit;\r
   }\r
+  \r
   // Setup a periodic timer, used for reading keystrokes at a fixed interval\r
   //\r
   Status = gBS->CreateEvent (\r
@@ -332,6 +333,19 @@ KbdControllerDriverStart (
     goto ErrorExit;\r
   }\r
 \r
+  Status = gBS->CreateEvent (\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_CALLBACK,\r
+                  KeyNotifyProcessHandler,\r
+                  ConsoleIn,\r
+                  &ConsoleIn->KeyNotifyProcessEvent\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    Status      = EFI_OUT_OF_RESOURCES;\r
+    StatusCode  = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;\r
+    goto ErrorExit;\r
+  }\r
+\r
   REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
     EFI_PROGRESS_CODE,\r
     EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT,\r
@@ -411,6 +425,9 @@ ErrorExit:
   if ((ConsoleIn != NULL) && (ConsoleIn->ConInEx.WaitForKeyEx != NULL)) {\r
     gBS->CloseEvent (ConsoleIn->ConInEx.WaitForKeyEx);\r
   }\r
+  if ((ConsoleIn != NULL) && (ConsoleIn->KeyNotifyProcessEvent != NULL)) {\r
+    gBS->CloseEvent (ConsoleIn->KeyNotifyProcessEvent);\r
+  }\r
   KbdFreeNotifyList (&ConsoleIn->NotifyList);\r
   if ((ConsoleIn != NULL) && (ConsoleIn->ControllerNameTable != NULL)) {\r
     FreeUnicodeStringTable (ConsoleIn->ControllerNameTable);\r
@@ -565,6 +582,10 @@ KbdControllerDriverStop (
     gBS->CloseEvent (ConsoleIn->ConInEx.WaitForKeyEx);\r
     ConsoleIn->ConInEx.WaitForKeyEx = NULL;\r
   }\r
+  if (ConsoleIn->KeyNotifyProcessEvent != NULL) {\r
+    gBS->CloseEvent (ConsoleIn->KeyNotifyProcessEvent);\r
+    ConsoleIn->KeyNotifyProcessEvent = NULL;\r
+  }\r
   KbdFreeNotifyList (&ConsoleIn->NotifyList);\r
   FreeUnicodeStringTable (ConsoleIn->ControllerNameTable);\r
   gBS->FreePool (ConsoleIn);\r