]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c
MdeModulePkg Ps2KbDxe: Execute key notify func at TPL_CALLBACK
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.c
index 657c65b851e1b7bc01a7d973e624983f8e47ed88..b6a9b70ca95af88195016f3512db95ff068e05f0 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 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
@@ -55,7 +55,7 @@ KbdControllerDriverStart (
   );\r
 \r
 /**\r
-  Stop this driver on ControllerHandle. Support stoping any child handles\r
+  Stop this driver on ControllerHandle. Support stopping any child handles\r
   created by this driver.\r
 \r
   @param  This              Protocol instance pointer.\r
@@ -255,16 +255,25 @@ KbdControllerDriverStart (
 \r
   //\r
   // Fix for random hangs in System waiting for the Key if no KBC is present in BIOS.\r
+  // When KBC decode (IO port 0x60/0x64 decode) is not enabled, \r
+  // KeyboardRead will read back as 0xFF and return status is EFI_SUCCESS.\r
+  // So instead we read status register to detect after read if KBC decode is enabled.\r
   //\r
-  KeyboardRead (ConsoleIn, &Data);\r
-  if ((KeyReadStatusRegister (ConsoleIn) & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {\r
-    //\r
-    // If nobody decodes KBC I/O port, it will read back as 0xFF.\r
-    // Check the Time-Out and Parity bit to see if it has an active KBC in system\r
-    //\r
-    Status      = EFI_DEVICE_ERROR;\r
-    StatusCode  = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;\r
-    goto ErrorExit;\r
+  \r
+  //\r
+  // Return code is ignored on purpose.\r
+  //\r
+  if (!PcdGetBool (PcdFastPS2Detection)) {\r
+    KeyboardRead (ConsoleIn, &Data);\r
+    if ((KeyReadStatusRegister (ConsoleIn) & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {\r
+      //\r
+      // If nobody decodes KBC I/O port, it will read back as 0xFF.\r
+      // Check the Time-Out and Parity bit to see if it has an active KBC in system\r
+      //\r
+      Status      = EFI_DEVICE_ERROR;\r
+      StatusCode  = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;\r
+      goto ErrorExit;\r
+    }\r
   }\r
   \r
   //\r
@@ -332,13 +341,19 @@ KbdControllerDriverStart (
   //\r
   // Reset the keyboard device\r
   //\r
-  Status = ConsoleIn->ConInEx.Reset (&ConsoleIn->ConInEx, TRUE);\r
+  Status = ConsoleIn->ConInEx.Reset (&ConsoleIn->ConInEx, FeaturePcdGet (PcdPs2KbdExtendedVerification));\r
   if (EFI_ERROR (Status)) {\r
     Status      = EFI_DEVICE_ERROR;\r
     StatusCode  = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;\r
     goto ErrorExit;\r
   }\r
 \r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DETECTED,\r
+    ParentDevicePath\r
+    );\r
+\r
   ConsoleIn->ControllerNameTable = NULL;\r
   AddUnicodeString2 (\r
     "eng",\r
@@ -433,7 +448,7 @@ ErrorExit:
 }\r
 \r
 /**\r
-  Stop this driver on ControllerHandle. Support stoping any child handles\r
+  Stop this driver on ControllerHandle. Support stopping any child handles\r
   created by this driver.\r
 \r
   @param  This              Protocol instance pointer.\r