]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModule/Ps2Kb: ReadKeyStrokeEx always return key state
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.h
index 79314e43de8817a4ae09335d0a32d128557618f1..613f176401ec6b09bb5a25e5506245e1556c5708 100644 (file)
@@ -1,8 +1,8 @@
-/**@file\r
+/** @file\r
   PS/2 keyboard driver header file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2018, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -12,18 +12,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#ifndef _PS2KEYBOARD_H\r
-#define _PS2KEYBOARD_H\r
+#ifndef _PS2KEYBOARD_H_\r
+#define _PS2KEYBOARD_H_\r
 \r
-#include <PiDxe.h>\r
-#include <Framework/StatusCode.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextInEx.h>\r
 #include <Protocol/IsaIo.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/Ps2Policy.h>\r
-#include <Protocol/SimpleTextInExNotify.h>\r
 \r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiLib.h>\r
@@ -34,22 +32,42 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #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
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL   gKeyboardControllerDriver;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gPs2KeyboardComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;\r
 \r
 //\r
 // Driver Private Data\r
 //\r
-#define KEYBOARD_BUFFER_MAX_COUNT         32\r
-#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE SIGNATURE_32 ('k', 'k', 'e', 'y')\r
+#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE       SIGNATURE_32 ('k', 'k', 'e', 'y')\r
 #define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('k', 'c', 'e', 'n')\r
 \r
 typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
-  UINTN                                 Signature;\r
-  EFI_HANDLE                            NotifyHandle;\r
-  EFI_KEY_DATA                          KeyData;\r
-  EFI_KEY_NOTIFY_FUNCTION               KeyNotificationFn;\r
-  LIST_ENTRY                            NotifyEntry;\r
+  UINTN                               Signature;\r
+  EFI_KEY_DATA                        KeyData;\r
+  EFI_KEY_NOTIFY_FUNCTION             KeyNotificationFn;\r
+  LIST_ENTRY                          NotifyEntry;\r
 } KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
 \r
+#define KEYBOARD_SCAN_CODE_MAX_COUNT  32\r
+typedef struct {\r
+  UINT8                               Buffer[KEYBOARD_SCAN_CODE_MAX_COUNT];\r
+  UINTN                               Head;\r
+  UINTN                               Tail;\r
+} SCAN_CODE_QUEUE;\r
+\r
+#define KEYBOARD_EFI_KEY_MAX_COUNT    256\r
+typedef struct {\r
+  EFI_KEY_DATA                        Buffer[KEYBOARD_EFI_KEY_MAX_COUNT];\r
+  UINTN                               Head;\r
+  UINTN                               Tail;\r
+} EFI_KEY_QUEUE;\r
 \r
 typedef struct {\r
   UINTN                               Signature;\r
@@ -65,36 +83,28 @@ typedef struct {
   UINT32                              StatusRegisterAddress;\r
   UINT32                              CommandRegisterAddress;\r
 \r
-  EFI_INPUT_KEY                       Key;\r
-  EFI_KEY_STATE                       KeyState;\r
-\r
+  BOOLEAN                             LeftCtrl;\r
+  BOOLEAN                             RightCtrl;\r
+  BOOLEAN                             LeftAlt;\r
+  BOOLEAN                             RightAlt;\r
   BOOLEAN                             LeftShift;\r
-  BOOLEAN                             RightShift;  \r
+  BOOLEAN                             RightShift;\r
   BOOLEAN                             LeftLogo;\r
   BOOLEAN                             RightLogo;\r
   BOOLEAN                             Menu;\r
   BOOLEAN                             SysReq;\r
 \r
-  BOOLEAN                             Ctrl;\r
-  BOOLEAN                             Alt;\r
-  BOOLEAN                             Shift;\r
   BOOLEAN                             CapsLock;\r
   BOOLEAN                             NumLock;\r
   BOOLEAN                             ScrollLock;\r
 \r
+  BOOLEAN                             IsSupportPartialKey;\r
   //\r
-  // Buffer storing key scancodes\r
-  //\r
-  UINT8                               ScancodeBuf[KEYBOARD_BUFFER_MAX_COUNT];\r
-  UINT32                              ScancodeBufStartPos;\r
-  UINT32                              ScancodeBufEndPos;\r
-  UINT32                              ScancodeBufCount;\r
-\r
-  //\r
-  // Indicators of the key pressing state, used in detecting Alt+Ctrl+Del\r
+  // Queue storing key scancodes\r
   //\r
-  BOOLEAN                             Ctrled;\r
-  BOOLEAN                             Alted;\r
+  SCAN_CODE_QUEUE                     ScancodeQueue;\r
+  EFI_KEY_QUEUE                       EfiKeyQueue;\r
+  EFI_KEY_QUEUE                       EfiKeyQueueForNotify;\r
 \r
   //\r
   // Error state\r
@@ -108,6 +118,7 @@ typedef struct {
   // Notification Function List\r
   //\r
   LIST_ENTRY                          NotifyList;\r
+  EFI_EVENT                           KeyNotifyProcessEvent;\r
 } KEYBOARD_CONSOLE_IN_DEV;\r
 \r
 #define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a)  CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)\r
@@ -120,23 +131,15 @@ typedef struct {
 \r
 #define TABLE_END 0x0\r
 \r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL   gKeyboardControllerDriver;\r
-extern EFI_COMPONENT_NAME_PROTOCOL   gPs2KeyboardComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;\r
-\r
-\r
 //\r
 // Driver entry point\r
 //\r
 /**\r
   The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 \r
@@ -160,7 +163,7 @@ InstallPs2KeyboardDriver (
 #define KEYBOARD_WAITFORVALUE_TIMEOUT   1000000 // 1s\r
 #define KEYBOARD_BAT_TIMEOUT            4000000 // 4s\r
 #define KEYBOARD_TIMER_INTERVAL         200000  // 0.02s\r
-#define SCANCODE_EXTENDED               0xE0\r
+#define SCANCODE_EXTENDED0              0xE0\r
 #define SCANCODE_EXTENDED1              0xE1\r
 #define SCANCODE_CTRL_MAKE              0x1D\r
 #define SCANCODE_CTRL_BREAK             0x9D\r
@@ -173,15 +176,53 @@ InstallPs2KeyboardDriver (
 #define SCANCODE_CAPS_LOCK_MAKE         0x3A\r
 #define SCANCODE_NUM_LOCK_MAKE          0x45\r
 #define SCANCODE_SCROLL_LOCK_MAKE       0x46\r
+#define SCANCODE_DELETE_MAKE            0x53\r
 #define SCANCODE_LEFT_LOGO_MAKE         0x5B //GUI key defined in Keyboard scan code\r
 #define SCANCODE_LEFT_LOGO_BREAK        0xDB\r
 #define SCANCODE_RIGHT_LOGO_MAKE        0x5C\r
 #define SCANCODE_RIGHT_LOGO_BREAK       0xDC\r
-#define SCANCODE_MENU_MAKE              0x5D //APPS key defined in Keyboard scan code \r
+#define SCANCODE_MENU_MAKE              0x5D //APPS key defined in Keyboard scan code\r
 #define SCANCODE_MENU_BREAK             0xDD\r
 #define SCANCODE_SYS_REQ_MAKE           0x37\r
+#define SCANCODE_SYS_REQ_BREAK          0xB7\r
+#define SCANCODE_SYS_REQ_MAKE_WITH_ALT  0x54\r
+#define SCANCODE_SYS_REQ_BREAK_WITH_ALT 0xD4\r
+\r
 #define SCANCODE_MAX_MAKE               0x60\r
 \r
+\r
+#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA     BIT0        ///< 0 - Output register has no data; 1 - Output register has data\r
+#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA      BIT1        ///< 0 - Input register has no data;  1 - Input register has data\r
+#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG         BIT2        ///< Set to 0 after power on reset\r
+#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE     BIT3        ///< 0 - Data in input register is data; 1 - Data in input register is command\r
+#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG         BIT4        ///< 0 - Keyboard is disable; 1 - Keyboard is enable\r
+#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT    BIT5        ///< 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete\r
+#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT     BIT6        ///< 0 - Receive is complete without timeout; 1 - Receive is timeout without complete\r
+#define KEYBOARD_STATUS_REGISTER_PARITY              BIT7        ///< 0 - Odd parity; 1 - Even parity\r
+\r
+#define KEYBOARD_8042_COMMAND_READ                          0x20\r
+#define KEYBOARD_8042_COMMAND_WRITE                         0x60\r
+#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE       0xA7\r
+#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE        0xA8\r
+#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST          0xAA\r
+#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST  0xAB\r
+#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE    0xAD\r
+\r
+#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA             0xF4\r
+#define KEYBOARD_8048_COMMAND_RESET                         0xFF\r
+#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET          0xF0\r
+\r
+#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS               0xAA\r
+#define KEYBOARD_8048_RETURN_8042_BAT_ERROR                 0xFC\r
+#define KEYBOARD_8048_RETURN_8042_ACK                       0xFA\r
+\r
+\r
+//\r
+// Keyboard Controller Status\r
+//\r
+#define KBC_PARE  0x80  // Parity Error\r
+#define KBC_TIM   0x40  // General Time Out\r
+\r
 //\r
 // Other functions that are used among .c files\r
 //\r
@@ -190,7 +231,7 @@ InstallPs2KeyboardDriver (
   indicators in ConsoleIn.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
-  \r
+\r
   @return status\r
 \r
 **/\r
@@ -200,7 +241,7 @@ UpdateStatusLights (
   );\r
 \r
 /**\r
-  write key to keyboard\r
+  write key to keyboard.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
   @param Data      value wanted to be written\r
@@ -216,23 +257,33 @@ KeyboardRead (
   );\r
 \r
 /**\r
-  Get scancode from scancode buffer\r
-  and translate into EFI-scancode and unicode defined by EFI spec\r
-  The function is always called in TPL_NOTIFY\r
+  Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.\r
 \r
-  @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r
+  The function is always called in TPL_NOTIFY.\r
 \r
-  @retval EFI_NOT_READY - Input from console not ready yet.\r
-  @retval EFI_SUCCESS   - Function executed successfully.\r
+  @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 KeyGetchar (\r
   IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
   );\r
 \r
 /**\r
-  Perform 8042 controller and keyboard Initialization\r
+  Process key notify.\r
+\r
+  @param  Event                 Indicates the event that invoke this function.\r
+  @param  Context               Indicates the calling context.\r
+**/\r
+VOID\r
+EFIAPI\r
+KeyNotifyProcessHandler (\r
+  IN  EFI_EVENT                 Event,\r
+  IN  VOID                      *Context\r
+  );\r
+\r
+/**\r
+  Perform 8042 controller and keyboard Initialization.\r
   If ExtendedVerification is TRUE, do additional test for\r
   the keyboard interface\r
 \r
@@ -249,7 +300,7 @@ InitKeyboard (
   );\r
 \r
 /**\r
-  Disable the keyboard interface of the 8042 controller\r
+  Disable the keyboard interface of the 8042 controller.\r
 \r
   @param ConsoleIn   - the device instance\r
 \r
@@ -285,9 +336,9 @@ KeyboardTimerHandler (
   Perform 8042 controller and keyboard initialization\r
 \r
   @param This    Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
-  @param ExtendedVerification Indicate that the driver may perform a more \r
-                              exhaustive verification operation of the device during \r
-                              reset, now this par is ignored in this driver    \r
+  @param ExtendedVerification Indicate that the driver may perform a more\r
+                              exhaustive verification operation of the device during\r
+                              reset, now this par is ignored in this driver\r
 \r
 **/\r
 EFI_STATUS\r
@@ -302,7 +353,7 @@ KeyboardEfiReset (
   Retrieve key values for driver user.\r
 \r
   @param This    Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
-  @param Key     The output buffer for key value \r
+  @param Key     The output buffer for key value\r
 \r
   @retval EFI_SUCCESS success to read key stroke\r
 **/\r
@@ -329,7 +380,7 @@ KeyboardWaitForKey (
   );\r
 \r
 /**\r
-  Read status register\r
+  Read status register.\r
 \r
   @param ConsoleIn  Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
@@ -346,7 +397,7 @@ KeyReadStatusRegister (
   If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r
   should not be in system.\r
 \r
-  @param[in]  BiosKeyboardPrivate   Keyboard Private Data Structure\r
+  @param[in]  ConsoleIn   Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
   @retval     TRUE                  Keyboard in System.\r
   @retval     FALSE                 Keyboard not in System.\r
@@ -370,7 +421,7 @@ EFIAPI
 KeyboardWaitForKeyEx (\r
   IN  EFI_EVENT               Event,\r
   IN  VOID                    *Context\r
-  );  \r
+  );\r
 \r
 //\r
 // Simple Text Input Ex protocol function prototypes\r
@@ -383,7 +434,7 @@ KeyboardWaitForKeyEx (
   @param ExtendedVerification - Driver may perform diagnostics on reset.\r
 \r
   @retval EFI_SUCCESS           - The device was reset.\r
-  @retval EFI_DEVICE_ERROR      - The device is not functioning properly and could \r
+  @retval EFI_DEVICE_ERROR      - The device is not functioning properly and could\r
                                   not be reset.\r
 \r
 **/\r
@@ -395,19 +446,19 @@ KeyboardEfiResetEx (
   );\r
 \r
 /**\r
-    Reads the next keystroke from the input device. The WaitForKey Event can \r
+    Reads the next keystroke from the input device. The WaitForKey Event can\r
     be used to test for existance of a keystroke via WaitForEvent () call.\r
 \r
 \r
     @param This       - Protocol instance pointer.\r
-    @param KeyData    - A pointer to a buffer that is filled in with the keystroke \r
+    @param KeyData    - A pointer to a buffer that is filled in with the keystroke\r
                  state data for the key that was pressed.\r
 \r
     @retval EFI_SUCCESS           - The keystroke information was returned.\r
     @retval EFI_NOT_READY         - There was no keystroke data availiable.\r
-    @retval EFI_DEVICE_ERROR      - The keystroke information was not returned due to \r
+    @retval EFI_DEVICE_ERROR      - The keystroke information was not returned due to\r
                             hardware errors.\r
-    @retval EFI_INVALID_PARAMETER - KeyData is NULL.                        \r
+    @retval EFI_INVALID_PARAMETER - KeyData is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -421,14 +472,14 @@ KeyboardReadKeyStrokeEx (
   Set certain state for the input device.\r
 \r
   @param This              - Protocol instance pointer.\r
-  @param KeyToggleState    - A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
+  @param KeyToggleState    - A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
                         state for the input device.\r
 \r
   @retval EFI_SUCCESS           - The device state was set successfully.\r
-  @retval EFI_DEVICE_ERROR      - The device is not functioning correctly and could \r
+  @retval EFI_DEVICE_ERROR      - The device is not functioning correctly and could\r
                             not have the setting adjusted.\r
   @retval EFI_UNSUPPORTED       - The device does not have the ability to set its state.\r
-  @retval EFI_INVALID_PARAMETER - KeyToggleState is NULL.                       \r
+  @retval EFI_INVALID_PARAMETER - KeyToggleState is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -442,43 +493,89 @@ KeyboardSetState (
     Register a notification function for a particular keystroke for the input device.\r
 \r
     @param This                    - Protocol instance pointer.\r
-    @param KeyData                 - A pointer to a buffer that is filled in with the keystroke \r
-                              information data for the key that was pressed.\r
-    @param KeyNotificationFunction - Points to the function to be called when the key \r
-                              sequence is typed specified by KeyData.                        \r
-    @param NotifyHandle            - Points to the unique handle assigned to the registered notification.                          \r
+    @param KeyData                 - A pointer to a buffer that is filled in with the keystroke\r
+                                     information data for the key that was pressed. If KeyData.Key,\r
+                                     KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState\r
+                                     are 0, then any incomplete keystroke will trigger a notification of\r
+                                     the KeyNotificationFunction.\r
+    @param KeyNotificationFunction - Points to the function to be called when the key\r
+                                     sequence is typed specified by KeyData. This notification function\r
+                                     should be called at <=TPL_CALLBACK.\r
+    @param NotifyHandle            - Points to the unique handle assigned to the registered notification.\r
 \r
     @retval EFI_SUCCESS             - The notification function was registered successfully.\r
     @retval EFI_OUT_OF_RESOURCES    - Unable to allocate resources for necesssary data structures.\r
-    @retval EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.                       \r
-                              \r
-**/   \r
+    @retval EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardRegisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
   IN EFI_KEY_DATA                       *KeyData,\r
   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,\r
-  OUT EFI_HANDLE                        *NotifyHandle\r
+  OUT VOID                              **NotifyHandle\r
   );\r
 \r
 /**\r
     Remove a registered notification function from a particular keystroke.\r
 \r
-    @param This                    - Protocol instance pointer.    \r
+    @param This                    - Protocol instance pointer.\r
     @param NotificationHandle      - The handle of the notification function being unregistered.\r
 \r
-  \r
+\r
     @retval EFI_SUCCESS             - The notification function was unregistered successfully.\r
     @retval EFI_INVALID_PARAMETER   - The NotificationHandle is invalid.\r
-    @retval EFI_NOT_FOUND           - Can not find the matching entry in database.  \r
-                              \r
-**/ \r
+    @retval EFI_NOT_FOUND           - Can not find the matching entry in database.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardUnregisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
-  IN EFI_HANDLE                         NotificationHandle\r
+  IN VOID                               *NotificationHandle\r
+  );\r
+\r
+/**\r
+  Push one key data to the EFI key buffer.\r
+\r
+  @param Queue     Pointer to instance of EFI_KEY_QUEUE.\r
+  @param KeyData   The key data to push.\r
+**/\r
+VOID\r
+PushEfikeyBufTail (\r
+  IN  EFI_KEY_QUEUE         *Queue,\r
+  IN  EFI_KEY_DATA          *KeyData\r
+  );\r
+\r
+/**\r
+  Judge whether is a registed key\r
+\r
+  @param RegsiteredData       A pointer to a buffer that is filled in with the keystroke\r
+                              state data for the key that was registered.\r
+  @param InputData            A pointer to a buffer that is filled in with the keystroke\r
+                              state data for the key that was pressed.\r
+\r
+  @retval TRUE                Key be pressed matches a registered key.\r
+  @retval FLASE               Match failed.\r
+\r
+**/\r
+BOOLEAN\r
+IsKeyRegistered (\r
+  IN EFI_KEY_DATA  *RegsiteredData,\r
+  IN EFI_KEY_DATA  *InputData\r
+  );\r
+\r
+/**\r
+  Initialize the key state.\r
+\r
+  @param  ConsoleIn     The KEYBOARD_CONSOLE_IN_DEV instance.\r
+  @param  KeyState      A pointer to receive the key state information.\r
+**/\r
+VOID\r
+InitializeKeyState (\r
+  IN  KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
+  OUT EFI_KEY_STATE           *KeyState\r
   );\r
 \r
 #endif\r