+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2004 - 2008, 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
-\r
-#include "efikey.h"\r
-#include "keyboard.h"\r
-\r
-//\r
-// Prototypes\r
-// Driver model protocol interface\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardDriverBindingEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\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
-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
-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
-// Simple Text In Protocol Interface\r
-//\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReset (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReadKeyStroke (\r
- IN EFI_SIMPLE_TEXT_INPUT_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
-EFI_GUID gEfiUsbKeyboardDriverGuid = {\r
- 0xa05f5f78, 0xfb3, 0x4d10, {0x90, 0x90, 0xac, 0x4, 0x6e, 0xeb, 0x7c, 0x3c}\r
-};\r
-STATIC\r
-EFI_STATUS\r
-KbdFreeNotifyList (\r
- IN OUT LIST_ENTRY *ListHead\r
- ); \r
-STATIC\r
-BOOLEAN\r
-IsKeyRegistered (\r
- IN EFI_KEY_DATA *RegsiteredData,\r
- IN EFI_KEY_DATA *InputData\r
- );\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
-USBKeyboardDriverBindingEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Driver Entry Point.\r
-\r
- Arguments:\r
- ImageHandle - EFI_HANDLE\r
- SystemTable - EFI_SYSTEM_TABLE\r
- Returns:\r
- EFI_STATUS\r
-\r
---*/\r
-{\r
- return EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gUsbKeyboardDriverBinding,\r
- ImageHandle,\r
- &gUsbKeyboardComponentName,\r
- &gUsbKeyboardComponentName2\r
- );\r
-}\r
-\r
-\r
-\r
-/**\r
- Supported.\r
-\r
- @param This EFI_DRIVER_BINDING_PROTOCOL\r
- @param Controller Controller handle\r
- @param RemainingDevicePath EFI_DEVICE_PATH_PROTOCOL\r
- EFI_STATUS\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
- 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
-\r
-/**\r
- Start.\r
-\r
- @param This EFI_DRIVER_BINDING_PROTOCOL\r
- @param Controller Controller handle\r
- @param RemainingDevicePath EFI_DEVICE_PATH_PROTOCOL\r
-\r
- @retval EFI_SUCCESS Success\r
- @retval EFI_OUT_OF_RESOURCES Can't allocate memory\r
- @retval EFI_UNSUPPORTED The Start routine fail\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
- 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
- PcdGet32 (PcdStatusCodeValueKeyboardEnable)\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
- PcdGet32 (PcdStatusCodeValueKeyboardPresenceDetect)\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
-\r
- UsbKeyboardDevice->SimpleInputEx.Reset = USBKeyboardResetEx;\r
- UsbKeyboardDevice->SimpleInputEx.ReadKeyStrokeEx = USBKeyboardReadKeyStrokeEx;\r
- UsbKeyboardDevice->SimpleInputEx.SetState = USBKeyboardSetState;\r
- UsbKeyboardDevice->SimpleInputEx.RegisterKeyNotify = USBKeyboardRegisterKeyNotify;\r
- UsbKeyboardDevice->SimpleInputEx.UnregisterKeyNotify = USBKeyboardUnregisterKeyNotify; \r
- \r
- InitializeListHead (&UsbKeyboardDevice->NotifyList);\r
- \r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- USBKeyboardWaitForKey,\r
- UsbKeyboardDevice,\r
- &(UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx)\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- goto ErrorExit;\r
- }\r
-\r
- Status = InitKeyboardLayout (UsbKeyboardDevice);\r
- if (EFI_ERROR (Status)) {\r
- goto ErrorExit;\r
- }\r
-\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
- &gEfiSimpleTextInputExProtocolGuid,\r
- &UsbKeyboardDevice->SimpleInputEx,\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
- &gEfiSimpleTextInputExProtocolGuid,\r
- &UsbKeyboardDevice->SimpleInputEx,\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
- &gEfiSimpleTextInputExProtocolGuid,\r
- &UsbKeyboardDevice->SimpleInputEx,\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
- AddUnicodeString2 (\r
- "eng",\r
- gUsbKeyboardComponentName.SupportedLanguages,\r
- &UsbKeyboardDevice->ControllerNameTable,\r
- L"Generic Usb Keyboard",\r
- TRUE\r
- );\r
- AddUnicodeString2 (\r
- "en",\r
- gUsbKeyboardComponentName2.SupportedLanguages,\r
- &UsbKeyboardDevice->ControllerNameTable,\r
- L"Generic Usb Keyboard",\r
- FALSE\r
- );\r
-\r
-\r
- return EFI_SUCCESS;\r
-\r
-ErrorExit:\r
- if (UsbKeyboardDevice != NULL) {\r
- if (UsbKeyboardDevice->SimpleInput.WaitForKey != NULL) {\r
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);\r
- }\r
- if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
- }\r
- KbdFreeNotifyList (&UsbKeyboardDevice->NotifyList); \r
- gBS->FreePool (UsbKeyboardDevice);\r
- UsbKeyboardDevice = NULL;\r
- }\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiUsbIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
- return Status;\r
-\r
-}\r
-\r
-\r
-\r
-/**\r
- Stop.\r
-\r
- @param This EFI_DRIVER_BINDING_PROTOCOL\r
- @param Controller Controller handle\r
- @param NumberOfChildren Child handle number\r
- @param ChildHandleBuffer Child handle buffer\r
-\r
- @retval EFI_SUCCESS Success\r
- @retval EFI_UNSUPPORTED Can't support\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
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_INPUT_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_GET_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
- Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiSimpleTextInputExProtocolGuid,\r
- NULL,\r
- This->DriverBindingHandle,\r
- Controller,\r
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_UNSUPPORTED;\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
- PcdGet32 (PcdStatusCodeValueKeyboardDisable)\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
- &gEfiSimpleTextInputExProtocolGuid,\r
- &UsbKeyboardDevice->SimpleInputEx,\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
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx); \r
- KbdFreeNotifyList (&UsbKeyboardDevice->NotifyList); \r
-\r
- ReleaseKeyboardLayoutResources (UsbKeyboardDevice);\r
- gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);\r
-\r
- if (UsbKeyboardDevice->ControllerNameTable != NULL) {\r
- FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);\r
- }\r
-\r
- gBS->FreePool (UsbKeyboardDevice);\r
-\r
- return Status;\r
-\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-USBKeyboardReadKeyStrokeWorker (\r
- IN USB_KB_DEV *UsbKeyboardDevice,\r
- OUT EFI_KEY_DATA *KeyData\r
- )\r
-/*++\r
-\r
- Routine Description:\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
- Arguments:\r
- UsbKeyboardDevice - Usb keyboard private structure.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
- state data for the key that was pressed.\r
-\r
- Returns:\r
- EFI_SUCCESS - The keystroke information was returned.\r
- EFI_NOT_READY - There was no keystroke data availiable.\r
- EFI_DEVICE_ERROR - The keystroke information was not returned due to \r
- hardware errors.\r
- EFI_INVALID_PARAMETER - KeyData is NULL. \r
-\r
---*/\r
-{\r
-\r
- EFI_STATUS Status;\r
- UINT8 KeyChar; \r
- LIST_ENTRY *Link;\r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; \r
- EFI_KEY_DATA OriginalKeyData;\r
-\r
- if (KeyData == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\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
- KeyData->Key.UnicodeChar = 0;\r
- KeyData->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, &KeyData->Key);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- CopyMem (&KeyData->KeyState, &UsbKeyboardDevice->KeyState, sizeof (KeyData->KeyState));\r
- \r
- UsbKeyboardDevice->KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;\r
- UsbKeyboardDevice->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
-\r
- //\r
- //Switch the control value to their original characters. In USBKeyCodeToEFIScanCode() the CTRL-Alpha characters have been switched to \r
- // their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A), here switch them back for notification function.\r
- //\r
- CopyMem (&OriginalKeyData, KeyData, sizeof (EFI_KEY_DATA));\r
- if (UsbKeyboardDevice->CtrlOn) {\r
- if (OriginalKeyData.Key.UnicodeChar >= 0x01 && OriginalKeyData.Key.UnicodeChar <= 0x1A) {\r
- if (UsbKeyboardDevice->CapsOn) {\r
- OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'A' - 1);\r
- } else {\r
- OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'a' - 1);\r
- } \r
- }\r
- }\r
- \r
- //\r
- // Invoke notification functions if exist\r
- //\r
- for (Link = UsbKeyboardDevice->NotifyList.ForwardLink; Link != &UsbKeyboardDevice->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = CR (\r
- Link, \r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
- NotifyEntry, \r
- USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
- );\r
- if (IsKeyRegistered (&CurrentNotify->KeyData, &OriginalKeyData)) { \r
- CurrentNotify->KeyNotificationFn (&OriginalKeyData);\r
- }\r
- }\r
-\r
- return EFI_SUCCESS;\r
- \r
-}\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReset (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\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
- PcdGet32 (PcdStatusCodeValueKeyboardReset)\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
- PcdGet32 (PcdStatusCodeValueKeyboardClearBuffer)\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
-\r
-/**\r
- Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke() function.\r
-\r
- This The EFI_SIMPLE_TEXT_INPUT_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
- @retval EFI_SUCCESS Success\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReadKeyStroke (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- OUT EFI_INPUT_KEY *Key\r
- )\r
-{\r
- USB_KB_DEV *UsbKeyboardDevice;\r
- EFI_STATUS Status;\r
- EFI_KEY_DATA KeyData;\r
-\r
- UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);\r
-\r
- Status = USBKeyboardReadKeyStrokeWorker (UsbKeyboardDevice, &KeyData);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/**\r
- Handler function for WaitForKey event.\r
-\r
- Event Event to be signaled when a key is pressed.\r
- Context Points to USB_KB_DEV instance.\r
-\r
- @return VOID\r
-\r
-**/\r
-STATIC\r
-VOID\r
-EFIAPI\r
-USBKeyboardWaitForKey (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\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
-\r
-/**\r
- Check whether there is key pending.\r
-\r
- UsbKeyboardDevice The USB_KB_DEV instance.\r
-\r
- @retval EFI_SUCCESS Success\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-USBKeyboardCheckForKey (\r
- IN USB_KB_DEV *UsbKeyboardDevice\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
-\r
-/**\r
- Report Status Code in Usb Bot Driver\r
-\r
- @param DevicePath Use this to get Device Path\r
- @param CodeType Status Code Type\r
- @param CodeValue Status Code Value\r
-\r
- @return None\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
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- CodeType,\r
- Value,\r
- DevicePath\r
- );\r
-}\r
-STATIC\r
-EFI_STATUS\r
-KbdFreeNotifyList (\r
- IN OUT LIST_ENTRY *ListHead\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- ListHead - The list head\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Free the notify list successfully\r
- EFI_INVALID_PARAMETER - ListHead is invalid.\r
-\r
---*/\r
-{\r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;\r
-\r
- if (ListHead == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- while (!IsListEmpty (ListHead)) {\r
- NotifyNode = CR (\r
- ListHead->ForwardLink, \r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
- NotifyEntry, \r
- USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
- );\r
- RemoveEntryList (ListHead->ForwardLink);\r
- gBS->FreePool (NotifyNode);\r
- }\r
- \r
- return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-BOOLEAN\r
-IsKeyRegistered (\r
- IN EFI_KEY_DATA *RegsiteredData,\r
- IN EFI_KEY_DATA *InputData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- RegsiteredData - A pointer to a buffer that is filled in with the keystroke \r
- state data for the key that was registered.\r
- InputData - A pointer to a buffer that is filled in with the keystroke \r
- state data for the key that was pressed.\r
-\r
-Returns:\r
- TRUE - Key be pressed matches a registered key.\r
- FLASE - Match failed. \r
- \r
---*/\r
-{\r
- ASSERT (RegsiteredData != NULL && InputData != NULL);\r
- \r
- if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||\r
- (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {\r
- return FALSE; \r
- } \r
- \r
- //\r
- // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.\r
- //\r
- if (RegsiteredData->KeyState.KeyShiftState != 0 &&\r
- RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {\r
- return FALSE; \r
- } \r
- if (RegsiteredData->KeyState.KeyToggleState != 0 &&\r
- RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {\r
- return FALSE; \r
- } \r
- \r
- return TRUE;\r
-\r
-}\r
-\r
-//\r
-// Simple Text Input Ex protocol functions \r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardResetEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Reset the input device and optionaly run diagnostics\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ExtendedVerification - Driver may perform diagnostics on reset.\r
-\r
- Returns:\r
- EFI_SUCCESS - The device was reset.\r
- EFI_DEVICE_ERROR - The device is not functioning properly and could \r
- not be reset.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- USB_KB_DEV *UsbKeyboardDevice;\r
- EFI_TPL OldTpl;\r
- \r
-\r
- UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
-\r
- Status = UsbKeyboardDevice->SimpleInput.Reset (&UsbKeyboardDevice->SimpleInput, ExtendedVerification);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_DEVICE_ERROR;\r
- }\r
-\r
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
- UsbKeyboardDevice->KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;\r
- UsbKeyboardDevice->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardReadKeyStrokeEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- OUT EFI_KEY_DATA *KeyData\r
- )\r
-/*++\r
-\r
- Routine Description:\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
- Arguments:\r
- This - Protocol instance pointer.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
- state data for the key that was pressed.\r
-\r
- Returns:\r
- EFI_SUCCESS - The keystroke information was returned.\r
- EFI_NOT_READY - There was no keystroke data availiable.\r
- EFI_DEVICE_ERROR - The keystroke information was not returned due to \r
- hardware errors.\r
- EFI_INVALID_PARAMETER - KeyData is NULL. \r
-\r
---*/\r
-{\r
- USB_KB_DEV *UsbKeyboardDevice;\r
-\r
- if (KeyData == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
-\r
- return USBKeyboardReadKeyStrokeWorker (UsbKeyboardDevice, KeyData);\r
- \r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardSetState (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Set certain state for the input device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
- state for the input device.\r
- \r
- Returns: \r
- EFI_SUCCESS - The device state was set successfully.\r
- EFI_DEVICE_ERROR - The device is not functioning correctly and could \r
- not have the setting adjusted.\r
- EFI_UNSUPPORTED - The device does not have the ability to set its state.\r
- EFI_INVALID_PARAMETER - KeyToggleState is NULL. \r
-\r
---*/ \r
-{\r
- USB_KB_DEV *UsbKeyboardDevice;\r
-\r
- if (KeyToggleState == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
-\r
- if (((UsbKeyboardDevice->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||\r
- ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Update the status light\r
- //\r
-\r
- UsbKeyboardDevice->ScrollOn = 0;\r
- UsbKeyboardDevice->NumLockOn = 0;\r
- UsbKeyboardDevice->CapsOn = 0;\r
- \r
- if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {\r
- UsbKeyboardDevice->ScrollOn = 1;\r
- }\r
- if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {\r
- UsbKeyboardDevice->NumLockOn = 1;\r
- }\r
- if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {\r
- UsbKeyboardDevice->CapsOn = 1;\r
- }\r
-\r
- SetKeyLED (UsbKeyboardDevice);\r
-\r
- UsbKeyboardDevice->KeyState.KeyToggleState = *KeyToggleState;\r
-\r
- return EFI_SUCCESS;\r
- \r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardRegisterKeyNotify (\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
- )\r
-/*++\r
-\r
- Routine Description:\r
- Register a notification function for a particular keystroke for the input device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- KeyData - A pointer to a buffer that is filled in with the keystroke \r
- information data for the key that was pressed.\r
- KeyNotificationFunction - Points to the function to be called when the key \r
- sequence is typed specified by KeyData. \r
- NotifyHandle - Points to the unique handle assigned to the registered notification. \r
-\r
- Returns:\r
- EFI_SUCCESS - The notification function was registered successfully.\r
- EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r
- EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. \r
- \r
---*/ \r
-{\r
- USB_KB_DEV *UsbKeyboardDevice;\r
- EFI_STATUS Status;\r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY *NewNotify;\r
- LIST_ENTRY *Link;\r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify; \r
-\r
- if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
-\r
- //\r
- // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.\r
- //\r
- for (Link = UsbKeyboardDevice->NotifyList.ForwardLink; Link != &UsbKeyboardDevice->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = CR (\r
- Link, \r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
- NotifyEntry, \r
- USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
- );\r
- if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) { \r
- if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {\r
- *NotifyHandle = CurrentNotify->NotifyHandle; \r
- return EFI_SUCCESS;\r
- }\r
- }\r
- }\r
- \r
- //\r
- // Allocate resource to save the notification function\r
- // \r
- NewNotify = (KEYBOARD_CONSOLE_IN_EX_NOTIFY *) AllocateZeroPool (sizeof (KEYBOARD_CONSOLE_IN_EX_NOTIFY));\r
- if (NewNotify == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- NewNotify->Signature = USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE; \r
- NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
- CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));\r
- InsertTailList (&UsbKeyboardDevice->NotifyList, &NewNotify->NotifyEntry);\r
-\r
- //\r
- // Use gSimpleTextInExNotifyGuid to get a valid EFI_HANDLE\r
- // \r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &NewNotify->NotifyHandle,\r
- &gSimpleTextInExNotifyGuid,\r
- NULL,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- \r
- *NotifyHandle = NewNotify->NotifyHandle; \r
- \r
- return EFI_SUCCESS;\r
- \r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-USBKeyboardUnregisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_HANDLE NotificationHandle\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Remove a registered notification function from a particular keystroke.\r
-\r
- Arguments:\r
- This - Protocol instance pointer. \r
- NotificationHandle - The handle of the notification function being unregistered.\r
-\r
- Returns:\r
- EFI_SUCCESS - The notification function was unregistered successfully.\r
- EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r
- EFI_NOT_FOUND - Can not find the matching entry in database. \r
- \r
---*/ \r
-{\r
- USB_KB_DEV *UsbKeyboardDevice;\r
- EFI_STATUS Status;\r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;\r
- LIST_ENTRY *Link;\r
-\r
- if (NotificationHandle == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- } \r
- \r
- UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
- \r
- Status = gBS->OpenProtocol (\r
- NotificationHandle,\r
- &gSimpleTextInExNotifyGuid,\r
- NULL,\r
- NULL,\r
- NULL,\r
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- for (Link = UsbKeyboardDevice->NotifyList.ForwardLink; Link != &UsbKeyboardDevice->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = CR (\r
- Link, \r
- KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
- NotifyEntry, \r
- USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
- ); \r
- if (CurrentNotify->NotifyHandle == NotificationHandle) {\r
- //\r
- // Remove the notification function from NotifyList and free resources\r
- //\r
- RemoveEntryList (&CurrentNotify->NotifyEntry); \r
- Status = gBS->UninstallMultipleProtocolInterfaces (\r
- CurrentNotify->NotifyHandle,\r
- &gSimpleTextInExNotifyGuid,\r
- NULL,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- gBS->FreePool (CurrentNotify); \r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND; \r
-}\r
-\r