]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / EdkModulePkg / Bus / Usb / UsbKb / Dxe / efikey.c
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
deleted file mode 100644 (file)
index 069e31d..0000000
+++ /dev/null
@@ -1,730 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
-  EfiKey.c\r
-\r
-Abstract:\r
-\r
-  USB Keyboard Driver\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#include "efikey.h"\r
-#include "keyboard.h"\r
-\r
-//\r
-// Simple Text In Protocol Interface\r
-//\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReset (\r
-  IN  EFI_SIMPLE_TEXT_IN_PROTOCOL  *This,\r
-  IN  BOOLEAN                      ExtendedVerification\r
-  );\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReadKeyStroke (\r
-  IN  EFI_SIMPLE_TEXT_IN_PROTOCOL   *This,\r
-  OUT EFI_INPUT_KEY                 *Key\r
-  );\r
-\r
-STATIC\r
-VOID\r
-EFIAPI\r
-USBKeyboardWaitForKey (\r
-  IN  EFI_EVENT               Event,\r
-  IN  VOID                    *Context\r
-  );\r
-\r
-//\r
-//  Helper functions\r
-//\r
-STATIC\r
-EFI_STATUS\r
-USBKeyboardCheckForKey (\r
-  IN  USB_KB_DEV      *UsbKeyboardDevice\r
-  );\r
-\r
-//\r
-// USB Keyboard Driver Global Variables\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {\r
-  USBKeyboardDriverBindingSupported,\r
-  USBKeyboardDriverBindingStart,\r
-  USBKeyboardDriverBindingStop,\r
-  0xa,\r
-  NULL,\r
-  NULL\r
-};\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardDriverBindingSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Supported.\r
-\r
-  Arguments:\r
-    This          - EFI_DRIVER_BINDING_PROTOCOL\r
-    Controller    - Controller handle\r
-    RemainingDevicePath - EFI_DEVICE_PATH_PROTOCOL\r
-  Returns:\r
-    EFI_STATUS\r
-\r
---*/\r
-{\r
-  EFI_STATUS          OpenStatus;\r
-  EFI_USB_IO_PROTOCOL *UsbIo;\r
-  EFI_STATUS          Status;\r
-\r
-  //\r
-  // Check if USB_IO protocol is attached on the controller handle.\r
-  //\r
-  OpenStatus = gBS->OpenProtocol (\r
-                      Controller,\r
-                      &gEfiUsbIoProtocolGuid,\r
-                      (VOID **) &UsbIo,\r
-                      This->DriverBindingHandle,\r
-                      Controller,\r
-                      EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                      );\r
-  if (EFI_ERROR (OpenStatus)) {\r
-    return OpenStatus;\r
-  }\r
-\r
-  //\r
-  // Use the USB I/O protocol interface to check whether the Controller is\r
-  // the Keyboard controller that can be managed by this driver.\r
-  //\r
-  Status = EFI_SUCCESS;\r
-\r
-  if (!IsUSBKeyboard (UsbIo)) {\r
-    Status = EFI_UNSUPPORTED;\r
-  }\r
-\r
-  gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiUsbIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
-\r
-  return Status;\r
-}\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
-\r
-  Routine Description:\r
-    Start.\r
-\r
-  Arguments:\r
-    This       - EFI_DRIVER_BINDING_PROTOCOL\r
-    Controller - Controller handle\r
-    RemainingDevicePath - EFI_DEVICE_PATH_PROTOCOL\r
-  Returns:\r
-    EFI_SUCCESS          - Success\r
-    EFI_OUT_OF_RESOURCES - Can't allocate memory\r
-    EFI_UNSUPPORTED      - The Start routine fail\r
---*/\r
-{\r
-  EFI_STATUS                    Status;\r
-  EFI_USB_IO_PROTOCOL           *UsbIo;\r
-  USB_KB_DEV                    *UsbKeyboardDevice;\r
-  UINT8                         EndpointNumber;\r
-  EFI_USB_ENDPOINT_DESCRIPTOR   EndpointDescriptor;\r
-  UINT8                         Index;\r
-  UINT8                         EndpointAddr;\r
-  UINT8                         PollingInterval;\r
-  UINT8                         PacketSize;\r
-  BOOLEAN                       Found;\r
-\r
-  UsbKeyboardDevice = NULL;\r
-  Found             = FALSE;\r
-\r
-  //\r
-  // Open USB_IO Protocol\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiUsbIoProtocolGuid,\r
-                  (VOID **) &UsbIo,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  UsbKeyboardDevice = AllocateZeroPool (sizeof (USB_KB_DEV));\r
-  if (UsbKeyboardDevice == NULL) {\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-  //\r
-  // Get the Device Path Protocol on Controller's handle\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &UsbKeyboardDevice->DevicePath,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return Status;\r
-  }\r
-  //\r
-  // Report that the usb keyboard is being enabled\r
-  //\r
-  KbdReportStatusCode (\r
-    UsbKeyboardDevice->DevicePath,\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE)\r
-    );\r
-\r
-  //\r
-  // This is pretty close to keyboard detection, so log progress\r
-  //\r
-  KbdReportStatusCode (\r
-    UsbKeyboardDevice->DevicePath,\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT)\r
-    );\r
-\r
-  //\r
-  // Initialize UsbKeyboardDevice\r
-  //\r
-  UsbKeyboardDevice->UsbIo = UsbIo;\r
-\r
-  //\r
-  // Get interface & endpoint descriptor\r
-  //\r
-  UsbIo->UsbGetInterfaceDescriptor (\r
-          UsbIo,\r
-          &UsbKeyboardDevice->InterfaceDescriptor\r
-          );\r
-\r
-  EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;\r
-\r
-  for (Index = 0; Index < EndpointNumber; Index++) {\r
-\r
-    UsbIo->UsbGetEndpointDescriptor (\r
-            UsbIo,\r
-            Index,\r
-            &EndpointDescriptor\r
-            );\r
-\r
-    if ((EndpointDescriptor.Attributes & 0x03) == 0x03) {\r
-      //\r
-      // We only care interrupt endpoint here\r
-      //\r
-      CopyMem (&UsbKeyboardDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));\r
-      Found = TRUE;\r
-    }\r
-  }\r
-\r
-  if (!Found) {\r
-    //\r
-    // No interrupt endpoint found, then return unsupported.\r
-    //\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  UsbKeyboardDevice->Signature                  = USB_KB_DEV_SIGNATURE;\r
-  UsbKeyboardDevice->SimpleInput.Reset          = USBKeyboardReset;\r
-  UsbKeyboardDevice->SimpleInput.ReadKeyStroke  = USBKeyboardReadKeyStroke;\r
-  Status = gBS->CreateEvent (\r
-                  EVT_NOTIFY_WAIT,\r
-                  TPL_NOTIFY,\r
-                  USBKeyboardWaitForKey,\r
-                  UsbKeyboardDevice,\r
-                  &(UsbKeyboardDevice->SimpleInput.WaitForKey)\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Install simple txt in protocol interface\r
-  // for the usb keyboard device.\r
-  // Usb keyboard is a hot plug device, and expected to work immediately\r
-  // when plugging into system, so a HotPlugDeviceGuid is installed onto\r
-  // the usb keyboard device handle, to distinguish it from other conventional\r
-  // console devices.\r
-  //\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &Controller,\r
-                  &gEfiSimpleTextInProtocolGuid,\r
-                  &UsbKeyboardDevice->SimpleInput,\r
-                  &gEfiHotPlugDeviceGuid,\r
-                  NULL,\r
-                  NULL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Reset USB Keyboard Device\r
-  //\r
-  Status = UsbKeyboardDevice->SimpleInput.Reset (\r
-                                            &UsbKeyboardDevice->SimpleInput,\r
-                                            TRUE\r
-                                            );\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->UninstallMultipleProtocolInterfaces (\r
-          Controller,\r
-          &gEfiSimpleTextInProtocolGuid,\r
-          &UsbKeyboardDevice->SimpleInput,\r
-          &gEfiHotPlugDeviceGuid,\r
-          NULL,\r
-          NULL\r
-          );\r
-    gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return Status;\r
-  }\r
-  //\r
-  // submit async interrupt transfer\r
-  //\r
-  EndpointAddr    = UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress;\r
-  PollingInterval = UsbKeyboardDevice->IntEndpointDescriptor.Interval;\r
-  PacketSize      = (UINT8) (UsbKeyboardDevice->IntEndpointDescriptor.MaxPacketSize);\r
-\r
-  Status = UsbIo->UsbAsyncInterruptTransfer (\r
-                    UsbIo,\r
-                    EndpointAddr,\r
-                    TRUE,\r
-                    PollingInterval,\r
-                    PacketSize,\r
-                    KeyboardHandler,\r
-                    UsbKeyboardDevice\r
-                    );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-\r
-    gBS->UninstallMultipleProtocolInterfaces (\r
-          Controller,\r
-          &gEfiSimpleTextInProtocolGuid,\r
-          &UsbKeyboardDevice->SimpleInput,\r
-          &gEfiHotPlugDeviceGuid,\r
-          NULL,\r
-          NULL\r
-          );\r
-    gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);\r
-    gBS->FreePool (UsbKeyboardDevice);\r
-    gBS->CloseProtocol (\r
-          Controller,\r
-          &gEfiUsbIoProtocolGuid,\r
-          This->DriverBindingHandle,\r
-          Controller\r
-          );\r
-    return Status;\r
-  }\r
-\r
-  UsbKeyboardDevice->ControllerNameTable = NULL;\r
-  AddUnicodeString (\r
-    "eng",\r
-    gUsbKeyboardComponentName.SupportedLanguages,\r
-    &UsbKeyboardDevice->ControllerNameTable,\r
-    (CHAR16 *) L"Generic Usb Keyboard"\r
-    );\r
-\r
-  return EFI_SUCCESS;\r
-}\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
-  Routine Description:\r
-    Stop.\r
-\r
-  Arguments:\r
-    This              - EFI_DRIVER_BINDING_PROTOCOL\r
-    Controller        - Controller handle\r
-    NumberOfChildren  - Child handle number\r
-    ChildHandleBuffer - Child handle buffer\r
-  Returns:\r
-    EFI_SUCCESS       - Success\r
-    EFI_UNSUPPORTED   - Can't support\r
---*/\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_SIMPLE_TEXT_IN_PROTOCOL *SimpleInput;\r
-  USB_KB_DEV                  *UsbKeyboardDevice;\r
-\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiSimpleTextInProtocolGuid,\r
-                  (VOID **) &SimpleInput,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Get USB_KB_DEV instance.\r
-  //\r
-  UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (SimpleInput);\r
-\r
-  gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiSimpleTextInProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
-\r
-  //\r
-  // Uninstall the Asyn Interrupt Transfer from this device\r
-  // will disable the key data input from this device\r
-  //\r
-  KbdReportStatusCode (\r
-    UsbKeyboardDevice->DevicePath,\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE)\r
-    );\r
-\r
-  //\r
-  // Destroy asynchronous interrupt transfer\r
-  //\r
-  UsbKeyboardDevice->UsbIo->UsbAsyncInterruptTransfer (\r
-                              UsbKeyboardDevice->UsbIo,\r
-                              UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress,\r
-                              FALSE,\r
-                              UsbKeyboardDevice->IntEndpointDescriptor.Interval,\r
-                              0,\r
-                              NULL,\r
-                              NULL\r
-                              );\r
-\r
-  gBS->CloseProtocol (\r
-        Controller,\r
-        &gEfiUsbIoProtocolGuid,\r
-        This->DriverBindingHandle,\r
-        Controller\r
-        );\r
-\r
-  Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                  Controller,\r
-                  &gEfiSimpleTextInProtocolGuid,\r
-                  &UsbKeyboardDevice->SimpleInput,\r
-                  &gEfiHotPlugDeviceGuid,\r
-                  NULL,\r
-                  NULL\r
-                  );\r
-  //\r
-  // free all the resources.\r
-  //\r
-  gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);\r
-  gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);\r
-  gBS->CloseEvent ((UsbKeyboardDevice->SimpleInput).WaitForKey);\r
-\r
-  if (UsbKeyboardDevice->ControllerNameTable != NULL) {\r
-    FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);\r
-  }\r
-\r
-  gBS->FreePool (UsbKeyboardDevice);\r
-\r
-  return Status;\r
-\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReset (\r
-  IN  EFI_SIMPLE_TEXT_IN_PROTOCOL   *This,\r
-  IN  BOOLEAN                       ExtendedVerification\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset() function.\r
-\r
-  Arguments:\r
-    This      The EFI_SIMPLE_TEXT_IN_PROTOCOL instance.\r
-    ExtendedVerification\r
-              Indicates that the driver may perform a more exhaustive\r
-              verification operation of the device during reset.\r
-\r
-  Returns:\r
-    EFI_SUCCESS      - Success\r
-    EFI_DEVICE_ERROR - Hardware Error\r
---*/\r
-{\r
-  EFI_STATUS          Status;\r
-  USB_KB_DEV          *UsbKeyboardDevice;\r
-\r
-  UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);\r
-\r
-  KbdReportStatusCode (\r
-    UsbKeyboardDevice->DevicePath,\r
-    EFI_PROGRESS_CODE,\r
-    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET)\r
-    );\r
-\r
-  //\r
-  // Non Exhaustive reset:\r
-  // only reset private data structures.\r
-  //\r
-  if (!ExtendedVerification) {\r
-    //\r
-    // Clear the key buffer of this Usb keyboard\r
-    //\r
-    KbdReportStatusCode (\r
-      UsbKeyboardDevice->DevicePath,\r
-      EFI_PROGRESS_CODE,\r
-      (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER)\r
-      );\r
-\r
-    InitUSBKeyBuffer (&(UsbKeyboardDevice->KeyboardBuffer));\r
-    UsbKeyboardDevice->CurKeyChar = 0;\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  //\r
-  // Exhaustive reset\r
-  //\r
-  Status                        = InitUSBKeyboard (UsbKeyboardDevice);\r
-  UsbKeyboardDevice->CurKeyChar = 0;\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReadKeyStroke (\r
-  IN  EFI_SIMPLE_TEXT_IN_PROTOCOL   *This,\r
-  OUT EFI_INPUT_KEY                 *Key\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.ReadKeyStroke() function.\r
-\r
-  Arguments:\r
-    This     The EFI_SIMPLE_TEXT_IN_PROTOCOL instance.\r
-    Key      A pointer to a buffer that is filled in with the keystroke\r
-             information for the key that was pressed.\r
-\r
-  Returns:\r
-    EFI_SUCCESS - Success\r
---*/\r
-{\r
-  USB_KB_DEV  *UsbKeyboardDevice;\r
-  EFI_STATUS  Status;\r
-  UINT8       KeyChar;\r
-\r
-  UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);\r
-\r
-  //\r
-  // if there is no saved ASCII byte, fetch it\r
-  // by calling USBKeyboardCheckForKey().\r
-  //\r
-  if (UsbKeyboardDevice->CurKeyChar == 0) {\r
-    Status = USBKeyboardCheckForKey (UsbKeyboardDevice);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-  }\r
-\r
-  Key->UnicodeChar              = 0;\r
-  Key->ScanCode                 = SCAN_NULL;\r
-\r
-  KeyChar                       = UsbKeyboardDevice->CurKeyChar;\r
-\r
-  UsbKeyboardDevice->CurKeyChar = 0;\r
-\r
-  //\r
-  // Translate saved ASCII byte into EFI_INPUT_KEY\r
-  //\r
-  Status = USBKeyCodeToEFIScanCode (UsbKeyboardDevice, KeyChar, Key);\r
-\r
-  return Status;\r
-\r
-}\r
-\r
-STATIC\r
-VOID\r
-EFIAPI\r
-USBKeyboardWaitForKey (\r
-  IN  EFI_EVENT               Event,\r
-  IN  VOID                    *Context\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Handler function for WaitForKey event.\r
-\r
-  Arguments:\r
-    Event        Event to be signaled when a key is pressed.\r
-    Context      Points to USB_KB_DEV instance.\r
-\r
-  Returns:\r
-    VOID\r
---*/\r
-{\r
-  USB_KB_DEV  *UsbKeyboardDevice;\r
-\r
-  UsbKeyboardDevice = (USB_KB_DEV *) Context;\r
-\r
-  if (UsbKeyboardDevice->CurKeyChar == 0) {\r
-\r
-    if (EFI_ERROR (USBKeyboardCheckForKey (UsbKeyboardDevice))) {\r
-      return ;\r
-    }\r
-  }\r
-  //\r
-  // If has key pending, signal the event.\r
-  //\r
-  gBS->SignalEvent (Event);\r
-}\r
-\r
-\r
-STATIC\r
-EFI_STATUS\r
-USBKeyboardCheckForKey (\r
-  IN  USB_KB_DEV    *UsbKeyboardDevice\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Check whether there is key pending.\r
-\r
-  Arguments:\r
-    UsbKeyboardDevice    The USB_KB_DEV instance.\r
-\r
-  Returns:\r
-    EFI_SUCCESS  - Success\r
---*/\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT8       KeyChar;\r
-\r
-  //\r
-  // Fetch raw data from the USB keyboard input,\r
-  // and translate it into ASCII data.\r
-  //\r
-  Status = USBParseKey (UsbKeyboardDevice, &KeyChar);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  UsbKeyboardDevice->CurKeyChar = KeyChar;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-KbdReportStatusCode (\r
-  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
-  IN EFI_STATUS_CODE_TYPE      CodeType,\r
-  IN EFI_STATUS_CODE_VALUE     Value\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    Report Status Code in Usb Bot Driver\r
-\r
-  Arguments:\r
-    DevicePath  - Use this to get Device Path\r
-    CodeType    - Status Code Type\r
-    CodeValue   - Status Code Value\r
-\r
-  Returns:\r
-    None\r
-\r
---*/\r
-{\r
-\r
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-    CodeType,\r
-    Value,\r
-    DevicePath\r
-    );\r
-}\r