]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add a PcdPs2KbdExtendedVerification to let user to choose whether extend reset for...
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Aug 2011 08:23:00 +0000 (08:23 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Aug 2011 08:23:00 +0000 (08:23 +0000)
Signed-off-by: li-elvin
Reviewed-by: mdkinney
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12207 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec

index 657c65b851e1b7bc01a7d973e624983f8e47ed88..0b4aff77903fe5832a2fb46b5d90134d96529c7b 100644 (file)
@@ -332,7 +332,7 @@ 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
index cf311d8d76d7ee1695533ffdc8b32d25ff6a781a..cb6abb5204e0d5e896fc5b91b9dd594c78755467 100644 (file)
@@ -33,6 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 //\r
 // Global Variables\r
index c1581185cc15fdbb0f3c918c9bd2386b59a761d7..61fd036c3c3779d102729f5d923ac95297819dc2 100644 (file)
@@ -4,7 +4,7 @@
 # The keyboard type implemented follows IBM compatible PS2 protocol, with Scan Codes Set 1.\r
 #\r
 # This dirver directly uses IsaIo protocol service to support KeyBoard work.\r
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -56,6 +56,7 @@
   BaseLib\r
   BaseMemoryLib\r
   TimerLib\r
+  PcdLib\r
   \r
 [Protocols]\r
   gEfiPs2PolicyProtocolGuid                     # PROTOCOL TO_START\r
@@ -64,6 +65,9 @@
   gEfiSimpleTextInputExProtocolGuid             # PROTOCOL BY_START\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL TO_START\r
 \r
+[FeaturePcd]\r
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification\r
+\r
 # [Event]\r
 #   ##\r
 #   # Event will be signaled for WaitForKey event.\r
index 06ef9d3345648e11824cbd2fc16ee18276b0f183..24578aab8176ae8f8cecfdf4f28ba871abead753 100644 (file)
@@ -361,10 +361,10 @@ BiosKeyboardDriverBindingStart (
   //\r
   Status = BiosKeyboardPrivate->SimpleTextInputEx.Reset (\r
                                                     &BiosKeyboardPrivate->SimpleTextInputEx,\r
-                                                    FALSE\r
+                                                    FeaturePcdGet (PcdPs2KbdExtendedVerification)\r
                                                     );\r
-\r
   if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "[KBD]Reset Failed. Status - %r\n", Status));  \r
     StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;\r
     goto Done;\r
   }\r
@@ -436,6 +436,7 @@ BiosKeyboardDriverBindingStart (
       }\r
     }\r
   }\r
+  DEBUG ((EFI_D_INFO, "[KBD]Extended keystrokes supported by CSM16 - %02x\n", (UINTN)BiosKeyboardPrivate->ExtendedKeyboard));\r
   //\r
   // Install protocol interfaces for the keyboard device.\r
   //\r
@@ -1679,6 +1680,12 @@ CheckKeyboardConnect (
              KBC_INPBUF_VIA60_KBEN\r
              );\r
   if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Keyboard enable failed!\n"));\r
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+      EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR,\r
+      BiosKeyboardPrivate->DevicePath\r
+      );\r
     return FALSE;\r
   }\r
 \r
@@ -1689,6 +1696,12 @@ CheckKeyboardConnect (
              );\r
 \r
   if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Timeout!\n"));\r
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+      EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR,\r
+      BiosKeyboardPrivate->DevicePath\r
+      );\r
     return FALSE;\r
   }\r
 \r
@@ -1763,6 +1776,13 @@ BiosKeyboardTimerHandler (
 \r
   KeyData.Key.ScanCode            = (UINT16) Regs.H.AH;\r
   KeyData.Key.UnicodeChar         = (UINT16) Regs.H.AL;\r
+  DEBUG ((\r
+    EFI_D_INFO,\r
+    "[KBD]INT16 returns EFI_INPUT_KEY.ScanCode - %x, EFI_INPUT_KEY.UnicodeChar - %x\n",\r
+    KeyData.Key.ScanCode,\r
+    KeyData.Key.UnicodeChar\r
+    ));\r
+  \r
   KeyData.KeyState.KeyShiftState  = EFI_SHIFT_STATE_VALID;\r
   KeyData.KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
   //\r
@@ -1801,6 +1821,40 @@ BiosKeyboardTimerHandler (
   KbFlag1 = *((UINT8 *) (UINTN) 0x417);  // read the STATUS FLAGS 1\r
   KbFlag2 = *((UINT8 *) (UINTN) 0x418); // read STATUS FLAGS 2\r
 \r
+  DEBUG_CODE (\r
+    {\r
+      if ((KbFlag1 & KB_CAPS_LOCK_BIT) == KB_CAPS_LOCK_BIT) {\r
+        DEBUG ((EFI_D_INFO, "[KBD]Caps Lock Key is pressed.\n"));\r
+      }\r
+      if ((KbFlag1 & KB_NUM_LOCK_BIT) == KB_NUM_LOCK_BIT) {\r
+        DEBUG ((EFI_D_INFO, "[KBD]Num Lock Key is pressed.\n"));\r
+      }\r
+      if ((KbFlag1 & KB_SCROLL_LOCK_BIT) == KB_SCROLL_LOCK_BIT) {\r
+        DEBUG ((EFI_D_INFO, "[KBD]Scroll Lock Key is pressed.\n"));\r
+      } \r
+      if ((KbFlag1 & KB_ALT_PRESSED) == KB_ALT_PRESSED) {\r
+        if ((KbFlag2 & KB_LEFT_ALT_PRESSED) == KB_LEFT_ALT_PRESSED) {\r
+          DEBUG ((EFI_D_INFO, "[KBD]Left Alt Key is pressed.\n"));\r
+        } else {\r
+          DEBUG ((EFI_D_INFO, "[KBD]Right Alt Key is pressed.\n"));\r
+        }\r
+      }  \r
+      if ((KbFlag1 & KB_CTRL_PRESSED) == KB_CTRL_PRESSED) {\r
+        if ((KbFlag2 & KB_LEFT_CTRL_PRESSED) == KB_LEFT_CTRL_PRESSED) {\r
+          DEBUG ((EFI_D_INFO, "[KBD]Left Ctrl Key is pressed.\n"));\r
+        } else {\r
+          DEBUG ((EFI_D_INFO, "[KBD]Right Ctrl Key is pressed.\n"));\r
+        }\r
+      }  \r
+      if ((KbFlag1 & KB_LEFT_SHIFT_PRESSED) == KB_LEFT_SHIFT_PRESSED) {\r
+        DEBUG ((EFI_D_INFO, "[KBD]Left Shift Key is pressed.\n"));\r
+      }\r
+      if ((KbFlag1 & KB_RIGHT_SHIFT_PRESSED) == KB_RIGHT_SHIFT_PRESSED) {\r
+        DEBUG ((EFI_D_INFO, "[KBD]Right Shift Key is pressed.\n"));\r
+      }\r
+    }\r
+  );\r
+\r
   //\r
   // Record toggle state\r
   //\r
@@ -1864,6 +1918,13 @@ BiosKeyboardTimerHandler (
     }\r
   }\r
 \r
+  DEBUG ((\r
+    EFI_D_INFO,\r
+    "[KBD]Convert to EFI Scan Code, EFI_INPUT_KEY.ScanCode - %x, EFI_INPUT_KEY.UnicodeChar - %x\n",\r
+    KeyData.Key.ScanCode,\r
+    KeyData.Key.UnicodeChar\r
+    ));\r
+\r
   //\r
   // Need not return associated shift state if a class of printable characters that\r
   // are normally adjusted by shift modifiers.\r
@@ -1872,6 +1933,7 @@ BiosKeyboardTimerHandler (
   if ((KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') ||\r
       (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z')\r
      ) {\r
+    DEBUG ((EFI_D_INFO, "[KBD]Shift key with a~z are pressed, remove shift state in EFI_KEY_STATE.\n"));\r
     KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);\r
   }\r
 \r
index 8dc14308b8ebf01db7db2bc4be3414491d0a8d3a..5e9fdabaa87be842b88f160295e748525b31cacf 100644 (file)
@@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 //\r
 // Driver Binding Externs\r
index 6166ba3ec3904db13acd3fbba3598e019ec34472..28ef29bf1cbf2dd0b74de9ea2ca3c86c27c4a1b9 100644 (file)
@@ -4,7 +4,7 @@
 # Ps2 Keyboard driver by using Legacy Bios protocol service and IsaIo protocol service.\r
 # This dirver uses legacy INT16 to get the key stroke status.\r
 #\r
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions\r
@@ -57,6 +57,7 @@
   UefiLib\r
   DebugLib\r
   BaseLib\r
+  PcdLib\r
 \r
 [Protocols]\r
   gEfiIsaIoProtocolGuid                         # PROTOCOL TO_START\r
@@ -66,3 +67,5 @@
   gEfiPs2PolicyProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
 \r
+[FeaturePcd]\r
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|FALSE
\ No newline at end of file
index 00542e9c93ae44a0bf04cdbd7220921e6956e19e..22888bbac6cb3e310ce436d3e35d363c53728352 100644 (file)
@@ -91,6 +91,9 @@
   #  If TRUE, CSM support is enclosed for ACPI S3 Save.\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformCsmSupport|TRUE|BOOLEAN|0x00010044\r
 \r
+  ## This PCD specifies whether PS2 keyboard does a extended verification during start.\r
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|TRUE|BOOLEAN|0x00010045\r
+\r
 [PcdsFixedAtBuild]\r
   ## FFS filename to find the default BMP Logo file.\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003\r