]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
Clean up the private GUID definition in module Level.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbKbDxe / EfiKey.h
index 616a9d0110581b825d0e290b54bf750186c43174..2066c38e7e9a654b8caf0b5ffad66b87efa8e251 100644 (file)
@@ -1,9 +1,8 @@
 /** @file\r
+  Header file for USB Keyboard Driver's Data Structures.\r
 \r
-    Header file for USB Keyboard Driver's Data Structures.\r
-\r
-Copyright (c) 2004 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2011, 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
@@ -23,8 +22,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/HiiDatabase.h>\r
 #include <Protocol/UsbIo.h>\r
 #include <Protocol/DevicePath.h>\r
+\r
 #include <Guid/HiiKeyBoardLayout.h>\r
-#include <Guid/HotPlugDevice.h>\r
+#include <Guid/UsbKeyBoardLayout.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
@@ -35,11 +35,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <Library/UsbLib.h>\r
-#include <Library/BaseLib.h>\r
+#include <Library/UefiUsbLib.h>\r
+#include <Library/HiiLib.h>\r
 \r
 #include <IndustryStandard/Usb.h>\r
 \r
+#define KEYBOARD_TIMER_INTERVAL         200000  // 0.02s\r
+\r
 #define MAX_KEY_ALLOWED     32\r
 \r
 #define HZ                  1000 * 1000 * 10\r
@@ -54,18 +56,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define REPORT_PROTOCOL     1\r
 \r
 typedef struct {\r
-  UINT8 Down;\r
-  UINT8 KeyCode;\r
+  BOOLEAN  Down;\r
+  UINT8    KeyCode;\r
 } USB_KEY;\r
 \r
 typedef struct {\r
-  USB_KEY buffer[MAX_KEY_ALLOWED + 1];\r
-  UINT8   bHead;\r
-  UINT8   bTail;\r
-} USB_KB_BUFFER;\r
+  VOID          *Buffer[MAX_KEY_ALLOWED + 1];\r
+  UINTN         Head;\r
+  UINTN         Tail;\r
+  UINTN         ItemSize;\r
+} USB_SIMPLE_QUEUE;\r
 \r
-#define USB_KB_DEV_SIGNATURE  EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')\r
-#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'x')\r
+#define USB_KB_DEV_SIGNATURE  SIGNATURE_32 ('u', 'k', 'b', 'd')\r
+#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'x')\r
 \r
 typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
   UINTN                                 Signature;\r
@@ -75,7 +78,7 @@ typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {
   LIST_ENTRY                            NotifyEntry;\r
 } KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
 \r
-#define USB_NS_KEY_SIGNATURE  EFI_SIGNATURE_32 ('u', 'n', 's', 'k')\r
+#define USB_NS_KEY_SIGNATURE  SIGNATURE_32 ('u', 'n', 's', 'k')\r
 \r
 typedef struct {\r
   UINTN                         Signature;\r
@@ -95,57 +98,62 @@ typedef struct {
 \r
 #define USB_NS_KEY_FORM_FROM_LINK(a)  CR (a, USB_NS_KEY, Link, USB_NS_KEY_SIGNATURE)\r
 \r
+///\r
+/// Structure to describe USB keyboard device\r
+///\r
 typedef struct {\r
-  UINTN                          Signature;\r
-  EFI_DEVICE_PATH_PROTOCOL       *DevicePath;\r
-  EFI_EVENT                      DelayedRecoveryEvent;\r
-  EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;\r
+  UINTN                             Signature;\r
+  EFI_HANDLE                        ControllerHandle;\r
+  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
+  EFI_EVENT                         DelayedRecoveryEvent;\r
+  EFI_SIMPLE_TEXT_INPUT_PROTOCOL    SimpleInput;\r
   EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;\r
-  EFI_USB_IO_PROTOCOL           *UsbIo;\r
+  EFI_USB_IO_PROTOCOL               *UsbIo;\r
+\r
+  EFI_USB_INTERFACE_DESCRIPTOR      InterfaceDescriptor;\r
+  EFI_USB_ENDPOINT_DESCRIPTOR       IntEndpointDescriptor;\r
 \r
-  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;\r
-  EFI_USB_ENDPOINT_DESCRIPTOR   IntEndpointDescriptor;\r
+  USB_SIMPLE_QUEUE                  UsbKeyQueue;\r
+  USB_SIMPLE_QUEUE                  EfiKeyQueue;\r
+  BOOLEAN                           CtrlOn;\r
+  BOOLEAN                           AltOn;\r
+  BOOLEAN                           ShiftOn;\r
+  BOOLEAN                           NumLockOn;\r
+  BOOLEAN                           CapsOn;\r
+  BOOLEAN                           ScrollOn;\r
+  UINT8                             LastKeyCodeArray[8];\r
+  UINT8                             CurKeyCode;\r
 \r
-  USB_KB_BUFFER                 KeyboardBuffer;\r
-  UINT8                         CtrlOn;\r
-  UINT8                         AltOn;\r
-  UINT8                         ShiftOn;\r
-  UINT8                         NumLockOn;\r
-  UINT8                         CapsOn;\r
-  UINT8                         ScrollOn;\r
-  UINT8                         LastKeyCodeArray[8];\r
-  UINT8                         CurKeyChar;\r
+  EFI_EVENT                         TimerEvent;\r
 \r
-  UINT8                         RepeatKey;\r
-  EFI_EVENT                     RepeatTimer;\r
+  UINT8                             RepeatKey;\r
+  EFI_EVENT                         RepeatTimer;\r
 \r
-  EFI_UNICODE_STRING_TABLE      *ControllerNameTable;\r
+  EFI_UNICODE_STRING_TABLE          *ControllerNameTable;\r
   \r
-  UINT8                         LeftCtrlOn;\r
-  UINT8                         LeftAltOn;\r
-  UINT8                         LeftShiftOn;\r
-  UINT8                         LeftLogoOn;\r
-  UINT8                         RightCtrlOn;\r
-  UINT8                         RightAltOn;\r
-  UINT8                         RightShiftOn;\r
-  UINT8                         RightLogoOn;  \r
-  UINT8                         MenuKeyOn;\r
-  UINT8                         SysReqOn;\r
-  UINT8                         AltGrOn;\r
-\r
-  EFI_KEY_STATE                 KeyState;\r
+  BOOLEAN                           LeftCtrlOn;\r
+  BOOLEAN                           LeftAltOn;\r
+  BOOLEAN                           LeftShiftOn;\r
+  BOOLEAN                           LeftLogoOn;\r
+  BOOLEAN                           RightCtrlOn;\r
+  BOOLEAN                           RightAltOn;\r
+  BOOLEAN                           RightShiftOn;\r
+  BOOLEAN                           RightLogoOn;  \r
+  BOOLEAN                           MenuKeyOn;\r
+  BOOLEAN                           SysReqOn;\r
+  BOOLEAN                           AltGrOn;\r
   //\r
   // Notification function list\r
   //\r
-  LIST_ENTRY                    NotifyList;\r
+  LIST_ENTRY                        NotifyList;\r
 \r
   //\r
   // Non-spacing key list\r
   //\r
-  LIST_ENTRY                    NsKeyList;\r
-  USB_NS_KEY                    *CurrentNsKey;\r
-  EFI_KEY_DESCRIPTOR            *KeyConvertionTable;\r
-  EFI_EVENT                     KeyboardLayoutEvent;\r
+  LIST_ENTRY                        NsKeyList;\r
+  USB_NS_KEY                        *CurrentNsKey;\r
+  EFI_KEY_DESCRIPTOR                *KeyConvertionTable;\r
+  EFI_EVENT                         KeyboardLayoutEvent;\r
 } USB_KB_DEV;\r
 \r
 //\r
@@ -154,70 +162,286 @@ typedef struct {
 extern EFI_DRIVER_BINDING_PROTOCOL   gUsbKeyboardDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL   gUsbKeyboardComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL  gUsbKeyboardComponentName2;\r
-extern EFI_GUID                      gEfiUsbKeyboardDriverGuid;\r
-extern EFI_GUID                      gSimpleTextInExNotifyGuid;\r
 \r
+#define USB_KB_DEV_FROM_THIS(a) \\r
+    CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r
+#define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r
+    CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r
+\r
+//\r
+// According to Universal Serial Bus HID Usage Tables document ver 1.12,\r
+// a Boot Keyboard should support the keycode range from 0x0 to 0x65 and 0xE0 to 0xE7.\r
+// 0xE0 to 0xE7 are for modifier keys, and 0x0 to 0x3 are reserved for typical\r
+// keyboard status or keyboard errors.\r
+// So the number of valid non-modifier USB keycodes is 0x62, and the number of\r
+// valid keycodes is 0x6A.\r
+//\r
+#define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE      0x62\r
+#define NUMBER_OF_VALID_USB_KEYCODE                   0x6A\r
+//\r
+// 0x0 to 0x3 are reserved for typical keyboard status or keyboard errors.\r
+//\r
+#define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)\r
+\r
+typedef struct {\r
+  UINT8 NumLock : 1;\r
+  UINT8 CapsLock : 1;\r
+  UINT8 ScrollLock : 1;\r
+  UINT8 Resrvd : 5;\r
+} LED_MAP;\r
+\r
+//\r
+// Functions of Driver Binding Protocol\r
+//\r
 /**\r
-  Report Status Code in Usb Keyboard Driver.\r
+  Check whether USB keyboard driver supports this device.\r
 \r
-  @param  DevicePath            Use this to get Device Path.\r
-  @param  CodeType              Status Code Type.\r
-  @param  CodeValue             Status Code Value.\r
+  @param  This                   The USB keyboard driver binding protocol.\r
+  @param  Controller             The controller handle to check.\r
+  @param  RemainingDevicePath    The remaining device path.\r
 \r
-  @return None.\r
+  @retval EFI_SUCCESS            The driver supports this controller.\r
+  @retval other                  This device isn't supported.\r
 \r
 **/\r
-VOID\r
+EFI_STATUS\r
 EFIAPI\r
-KbdReportStatusCode (\r
-  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
-  IN EFI_STATUS_CODE_TYPE      CodeType,\r
-  IN EFI_STATUS_CODE_VALUE     Value\r
+USBKeyboardDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
+  IN EFI_HANDLE                     Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   );\r
 \r
-#define USB_KB_DEV_FROM_THIS(a) \\r
-    CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r
-#define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r
-    CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r
+/**\r
+  Starts the keyboard device with this driver.\r
 \r
+  This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
+  initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
+  this keyboard device.\r
 \r
-#define MOD_CONTROL_L           0x01\r
-#define MOD_CONTROL_R           0x10\r
-#define MOD_SHIFT_L             0x02\r
-#define MOD_SHIFT_R             0x20\r
-#define MOD_ALT_L               0x04\r
-#define MOD_ALT_R               0x40\r
-#define MOD_WIN_L               0x08\r
-#define MOD_WIN_R               0x80\r
+  @param  This                   The USB keyboard driver binding instance.\r
+  @param  Controller             Handle of device to bind driver to.\r
+  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
+                                 device to start.\r
 \r
-typedef struct {\r
-  UINT8 Mask;\r
-  UINT8 Key;\r
-} KB_MODIFIER;\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb keyboard driver.\r
+  @retval EFI_UNSUPPORTED        No interrupt endpoint can be found.\r
+  @retval Other                  This controller cannot be started.\r
 \r
-#define USB_KEYCODE_MAX_MAKE      0x62\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
+  IN EFI_HANDLE                     Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
+  );\r
 \r
-#define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)\r
+/**\r
+  Stop the USB keyboard device handled by this driver.\r
 \r
-typedef struct {\r
-  UINT8 NumLock : 1;\r
-  UINT8 CapsLock : 1;\r
-  UINT8 ScrollLock : 1;\r
-  UINT8 Resrvd : 5;\r
-} LED_MAP;\r
+  @param  This                   The USB keyboard driver binding protocol.\r
+  @param  Controller             The controller to release.\r
+  @param  NumberOfChildren       The number of handles in ChildHandleBuffer.\r
+  @param  ChildHandleBuffer      The array of child handle.\r
+\r
+  @retval EFI_SUCCESS            The device was stopped.\r
+  @retval EFI_UNSUPPORTED        Simple Text In Protocol or Simple Text In Ex Protocol\r
+                                 is not installed on Controller.\r
+  @retval EFI_DEVICE_ERROR       The device could not be stopped due to a device error.\r
+  @retval Others                 Fail to uninstall protocols attached on the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardDriverBindingStop (\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL    *This,\r
+  IN  EFI_HANDLE                     Controller,\r
+  IN  UINTN                          NumberOfChildren,\r
+  IN  EFI_HANDLE                     *ChildHandleBuffer\r
+  );\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 4646 or ISO 639-2 language code format.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbKeyboardComponentNameGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  );\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 4646 or ISO 639-2 language code format.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbKeyboardComponentNameGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  );\r
+\r
+//\r
+// Functions of Simple Text Input Protocol\r
+//\r
+/**\r
+  Reset the input device and optionaly run diagnostics\r
+\r
+  There are 2 types of reset for USB keyboard.\r
+  For non-exhaustive reset, only keyboard buffer is cleared.\r
+  For exhaustive reset, in addition to clearance of keyboard buffer, the hardware status\r
+  is also re-initialized.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @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 not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardReset (\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL   *This,\r
+  IN  BOOLEAN                          ExtendedVerification\r
+  );\r
+\r
+/**\r
+  Reads the next keystroke from the input device.\r
+\r
+  @param  This                 The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.\r
+  @param  Key                  A pointer to a buffer that is filled in with the keystroke\r
+                               information 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 keydtroke information was not returned due to\r
+                               hardware errors.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardReadKeyStroke (\r
+  IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL   *This,\r
+  OUT EFI_INPUT_KEY                    *Key\r
+  );\r
 \r
 //\r
 // Simple Text Input Ex protocol functions\r
 //\r
 /**\r
-  The extension routine to reset the input device.\r
+  Resets the input device hardware.\r
+\r
+  The Reset() function resets the input device hardware. As part\r
+  of initialization process, the firmware/device will make a quick\r
+  but reasonable attempt to verify that the device is functioning.\r
+  If the ExtendedVerification flag is TRUE the firmware may take\r
+  an extended amount of time to verify the device is operating on\r
+  reset. Otherwise the reset operation is to occur as quickly as\r
+  possible. The hardware verification process is not defined by\r
+  this specification and is left up to the platform firmware or\r
+  driver to implement.\r
 \r
-  @param This                     Protocol instance pointer.\r
-  @param ExtendedVerification     Driver may perform diagnostics on reset.\r
+  @param This                 A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r
 \r
-  @retval EFI_SUCCESS             The device was reset.\r
-  @retval EFI_DEVICE_ERROR        The device is not functioning properly and could\r
-                                  not be reset.\r
+  @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
+                              verification operation of the device during reset.\r
+\r
+  @retval EFI_SUCCESS         The device was reset.\r
+  @retval EFI_DEVICE_ERROR    The device is not functioning correctly and could not be reset.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -228,16 +452,17 @@ USBKeyboardResetEx (
   );\r
 \r
 /**\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
+  Reads the next keystroke from 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
-                                  state data for the key that was pressed.\r
+  @param  This                   Protocol instance pointer.\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
-  @return EFI_SUCCESS             The keystroke information was returned successfully.\r
-  @retval EFI_INVALID_PARAMETER   KeyData is NULL.\r
-  @retval Other                   Read key stroke information failed.\r
+  @retval EFI_SUCCESS            The keystroke information was returned.\r
+  @retval EFI_NOT_READY          There was no keystroke data available.\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
 \r
 **/\r
 EFI_STATUS\r
@@ -254,8 +479,10 @@ USBKeyboardReadKeyStrokeEx (
   @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_UNSUPPORTED         The device does not have the ability to set its state.\r
+  @retval EFI_SUCCESS             The device state was set appropriately.\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 support the ability to have its state set.\r
   @retval EFI_INVALID_PARAMETER   KeyToggleState is NULL.\r
 \r
 **/\r
@@ -278,7 +505,7 @@ USBKeyboardSetState (
 \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
+  @retval EFI_INVALID_PARAMETER       KeyData or NotifyHandle or KeyNotificationFunction is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -297,9 +524,8 @@ USBKeyboardRegisterKeyNotify (
   @param  NotificationHandle        The handle of the notification function being unregistered.\r
 \r
   @retval EFI_SUCCESS              The notification function was unregistered successfully.\r
-  @retval EFI_INVALID_PARAMETER    The NotificationHandle is invalid or opening gSimpleTextInExNotifyGuid\r
-                                   on NotificationHandle fails.\r
-  @retval EFI_NOT_FOUND            Can not find the matching entry in database.\r
+  @retval EFI_INVALID_PARAMETER    The NotificationHandle is invalid\r
+  @retval EFI_NOT_FOUND            Cannot find the matching entry in database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -309,5 +535,63 @@ USBKeyboardUnregisterKeyNotify (
   IN EFI_HANDLE                         NotificationHandle\r
   );\r
 \r
+/**\r
+  Event notification function registered for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx\r
+  and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey.\r
+\r
+  @param  Event        Event to be signaled when a key is pressed.\r
+  @param  Context      Points to USB_KB_DEV instance.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+USBKeyboardWaitForKey (\r
+  IN  EFI_EVENT               Event,\r
+  IN  VOID                    *Context\r
+  );\r
+\r
+/**\r
+  Free keyboard notify list.\r
+\r
+  @param  NotifyList              The keyboard notify list to free.\r
+\r
+  @retval EFI_SUCCESS             Free the notify list successfully.\r
+  @retval EFI_INVALID_PARAMETER   NotifyList is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+KbdFreeNotifyList (\r
+  IN OUT LIST_ENTRY           *NotifyList\r
+  );\r
+\r
+/**\r
+  Check whether the pressed key matches a registered key or not.\r
+\r
+  @param  RegsiteredData    A pointer to keystroke data for the key that was registered.\r
+  @param  InputData         A pointer to keystroke data for the key that was pressed.\r
+\r
+  @retval TRUE              Key pressed matches a registered key.\r
+  @retval FLASE             Key pressed does not matche a registered key.\r
+\r
+**/\r
+BOOLEAN\r
+IsKeyRegistered (\r
+  IN EFI_KEY_DATA  *RegsiteredData,\r
+  IN EFI_KEY_DATA  *InputData\r
+  );\r
+\r
+/**\r
+  Timer handler to convert the key from USB.\r
+\r
+  @param  Event                    Indicates the event that invoke this function.\r
+  @param  Context                  Indicates the calling context.\r
+**/\r
+VOID\r
+EFIAPI\r
+USBKeyboardTimerHandler (\r
+  IN  EFI_EVENT                 Event,\r
+  IN  VOID                      *Context\r
+  );\r
+\r
 #endif\r
 \r