+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef _BIOS_KEYBOARD_H_\r
-#define _BIOS_KEYBOARD_H_\r
-\r
-\r
-#include <FrameworkDxe.h>\r
-#include <Pi/PiDxeCis.h>\r
-\r
-#include <Guid/StatusCodeDataTypeId.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/SimpleTextInEx.h>\r
-#include <Protocol/LegacyBios.h>\r
-#include <Protocol/IsaIo.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/Ps2Policy.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DxeServicesTableLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-//\r
-// Driver Binding Externs\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gBiosKeyboardDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gBiosKeyboardComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gBiosKeyboardComponentName2;\r
-\r
-\r
-#include <IndustryStandard/Pci.h>\r
-\r
-//\r
-// BISO Keyboard Defines\r
-//\r
-#define CHAR_SCANCODE 0xe0\r
-#define CHAR_ESC 0x1b\r
-\r
-#define KEYBOARD_8042_DATA_REGISTER 0x60\r
-#define KEYBOARD_8042_STATUS_REGISTER 0x64\r
-#define KEYBOARD_8042_COMMAND_REGISTER 0x64\r
-\r
-#define KEYBOARD_TIMEOUT 65536 // 0.07s\r
-#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s\r
-#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s\r
-#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r
-// KEYBOARD COMMAND BYTE -- read by writing command KBC_CMDREG_VIA64_CMDBYTE_R to 64H, then read from 60H\r
-// write by wrting command KBC_CMDREG_VIA64_CMDBYTE_W to 64H, then write to 60H\r
-// 7: Reserved\r
-// 6: PC/XT translation mode convert\r
-// 5: Disable Auxiliary device interface\r
-// 4: Disable keyboard interface\r
-// 3: Reserved\r
-// 2: System Flag: selftest successful\r
-// 1: Enable Auxiliary device interrupt\r
-// 0: Enable Keyboard interrupt )\r
-//\r
-#define KB_CMMBYTE_KSCAN2UNI_COV (0x1 << 6)\r
-#define KB_CMMBYTE_DISABLE_AUX (0x1 << 5)\r
-#define KB_CMMBYTE_DISABLE_KB (0x1 << 4)\r
-#define KB_CMMBYTE_SLFTEST_SUCC (0x1 << 2)\r
-#define KB_CMMBYTE_ENABLE_AUXINT (0x1 << 1)\r
-#define KB_CMMBYTE_ENABLE_KBINT (0x1 << 0)\r
-\r
-//\r
-// KEYBOARD CONTROLLER STATUS REGISTER - read from 64h\r
-// 7: Parity error\r
-// 6: General time out\r
-// 5: Output buffer holds data for AUX\r
-// 4: Keyboard is not locked\r
-// 3: Command written via 64h / Data written via 60h\r
-// 2: KBC self-test successful / Power-on reset\r
-// 1: Input buffer holds CPU data / empty\r
-// 0: Output buffer holds keyboard data / empty\r
-//\r
-#define KBC_STSREG_VIA64_PARE (0x1 << 7)\r
-#define KBC_STSREG_VIA64_TIM (0x1 << 6)\r
-#define KBC_STSREG_VIA64_AUXB (0x1 << 5)\r
-#define KBC_STSREG_VIA64_KEYL (0x1 << 4)\r
-#define KBC_STSREG_VIA64_C_D (0x1 << 3)\r
-#define KBC_STSREG_VIA64_SYSF (0x1 << 2)\r
-#define KBC_STSREG_VIA64_INPB (0x1 << 1)\r
-#define KBC_STSREG_VIA64_OUTB (0x1 << 0)\r
-\r
-//\r
-// COMMANDs of KEYBOARD CONTROLLER COMMAND REGISTER - write to 64h\r
-//\r
-#define KBC_CMDREG_VIA64_CMDBYTE_R 0x20\r
-#define KBC_CMDREG_VIA64_CMDBYTE_W 0x60\r
-#define KBC_CMDREG_VIA64_AUX_DISABLE 0xA7\r
-#define KBC_CMDREG_VIA64_AUX_ENABLE 0xA8\r
-#define KBC_CMDREG_VIA64_KBC_SLFTEST 0xAA\r
-#define KBC_CMDREG_VIA64_KB_CKECK 0xAB\r
-#define KBC_CMDREG_VIA64_KB_DISABLE 0xAD\r
-#define KBC_CMDREG_VIA64_KB_ENABLE 0xAE\r
-#define KBC_CMDREG_VIA64_INTP_LOW_R 0xC0\r
-#define KBC_CMDREG_VIA64_INTP_HIGH_R 0xC2\r
-#define KBC_CMDREG_VIA64_OUTP_R 0xD0\r
-#define KBC_CMDREG_VIA64_OUTP_W 0xD1\r
-#define KBC_CMDREG_VIA64_OUTB_KB_W 0xD2\r
-#define KBC_CMDREG_VIA64_OUTB_AUX_W 0xD3\r
-#define KBC_CMDREG_VIA64_AUX_W 0xD4\r
-\r
-//\r
-// echos of KEYBOARD CONTROLLER COMMAND - read from 60h\r
-//\r
-#define KBC_CMDECHO_KBCSLFTEST_OK 0x55\r
-#define KBC_CMDECHO_KBCHECK_OK 0x00\r
-#define KBC_CMDECHO_ACK 0xFA\r
-#define KBC_CMDECHO_BATTEST_OK 0xAA\r
-#define KBC_CMDECHO_BATTEST_FAILE 0xFC\r
-\r
-//\r
-// OUTPUT PORT COMMANDs - write port by writing KBC_CMDREG_VIA64_OUTP_W via 64H, then write the command to 60H\r
-// drive data and clock of KB to high for at least 500us for BAT needs\r
-//\r
-#define KBC_OUTPORT_DCHIGH_BAT 0xC0\r
-//\r
-// scan code set type\r
-//\r
-#define KBC_INPBUF_VIA60_SCODESET1 0x01\r
-#define KBC_INPBUF_VIA60_SCODESET2 0x02\r
-#define KBC_INPBUF_VIA60_SCODESET3 0x03\r
-\r
-//\r
-// COMMANDs written to INPUT BUFFER - write to 60h\r
-//\r
-#define KBC_INPBUF_VIA60_KBECHO 0xEE\r
-#define KBC_INPBUF_VIA60_KBSCODE 0xF0\r
-#define KBC_INPBUF_VIA60_KBTYPE 0xF2\r
-#define KBC_INPBUF_VIA60_KBDELAY 0xF3\r
-#define KBC_INPBUF_VIA60_KBEN 0xF4\r
-#define KBC_INPBUF_VIA60_KBSTDDIS 0xF5\r
-#define KBC_INPBUF_VIA60_KBSTDEN 0xF6\r
-#define KBC_INPBUF_VIA60_KBRESEND 0xFE\r
-#define KBC_INPBUF_VIA60_KBRESET 0xFF\r
-\r
-//\r
-// 0040h:0017h - KEYBOARD - STATUS FLAGS 1\r
-// 7 INSert active\r
-// 6 Caps Lock active\r
-// 5 Num Lock active\r
-// 4 Scroll Lock active\r
-// 3 either Alt pressed\r
-// 2 either Ctrl pressed\r
-// 1 Left Shift pressed\r
-// 0 Right Shift pressed\r
-//\r
-// 0040h:0018h - KEYBOARD - STATUS FLAGS 2\r
-// 7: insert key is depressed\r
-// 6: caps-lock key is depressed (does not work well)\r
-// 5: num-lock key is depressed (does not work well)\r
-// 4: scroll lock key is depressed (does not work well)\r
-// 3: suspend key has been toggled (does not work well)\r
-// 2: system key is pressed and held (does not work well)\r
-// 1: left ALT key is pressed\r
-// 0: left CTRL key is pressed\r
-//\r
-#define KB_INSERT_BIT (0x1 << 7)\r
-#define KB_CAPS_LOCK_BIT (0x1 << 6)\r
-#define KB_NUM_LOCK_BIT (0x1 << 5)\r
-#define KB_SCROLL_LOCK_BIT (0x1 << 4)\r
-#define KB_ALT_PRESSED (0x1 << 3)\r
-#define KB_CTRL_PRESSED (0x1 << 2)\r
-#define KB_LEFT_SHIFT_PRESSED (0x1 << 1)\r
-#define KB_RIGHT_SHIFT_PRESSED (0x1 << 0)\r
-\r
-#define KB_SUSPEND_PRESSED (0x1 << 3)\r
-#define KB_SYSREQ_PRESSED (0x1 << 2)\r
-#define KB_LEFT_ALT_PRESSED (0x1 << 1)\r
-#define KB_LEFT_CTRL_PRESSED (0x1 << 0)\r
-\r
-//\r
-// BIOS Keyboard Device Structure\r
-//\r
-#define BIOS_KEYBOARD_DEV_SIGNATURE SIGNATURE_32 ('B', 'K', 'B', 'D')\r
-#define BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('c', 'b', 'k', 'h')\r
-\r
-typedef struct _BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
- UINTN Signature;\r
- EFI_KEY_DATA KeyData;\r
- EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
- LIST_ENTRY NotifyEntry;\r
-} BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
-\r
-#define QUEUE_MAX_COUNT 32\r
-typedef struct {\r
- UINTN Front;\r
- UINTN Rear;\r
- EFI_KEY_DATA Buffer[QUEUE_MAX_COUNT];\r
-} SIMPLE_QUEUE;\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- EFI_HANDLE Handle;\r
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;\r
- EFI_ISA_IO_PROTOCOL *IsaIo;\r
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;\r
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInputEx;\r
- UINT16 DataRegisterAddress;\r
- UINT16 StatusRegisterAddress;\r
- UINT16 CommandRegisterAddress;\r
- BOOLEAN ExtendedKeyboard;\r
-\r
- EFI_KEY_STATE KeyState;\r
- //\r
- // Buffer storing EFI_KEY_DATA\r
- //\r
- SIMPLE_QUEUE Queue;\r
- SIMPLE_QUEUE QueueForNotify;\r
-\r
- //\r
- // Notification Function List\r
- //\r
- LIST_ENTRY NotifyList;\r
- EFI_EVENT KeyNotifyProcessEvent;\r
- EFI_EVENT TimerEvent;\r
-\r
-} BIOS_KEYBOARD_DEV;\r
-\r
-#define BIOS_KEYBOARD_DEV_FROM_THIS(a) CR (a, BIOS_KEYBOARD_DEV, SimpleTextIn, BIOS_KEYBOARD_DEV_SIGNATURE)\r
-#define TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS(a) \\r
- CR (a, \\r
- BIOS_KEYBOARD_DEV, \\r
- SimpleTextInputEx, \\r
- BIOS_KEYBOARD_DEV_SIGNATURE \\r
- )\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gBiosKeyboardDriverBinding;\r
-\r
-//\r
-// Driver Binding Protocol functions\r
-//\r
-\r
-/**\r
- Check whether the driver supports this device.\r
-\r
- @param This The Udriver binding protocol.\r
- @param Controller The controller handle to check.\r
- @param RemainingDevicePath The remaining device path.\r
-\r
- @retval EFI_SUCCESS The driver supports this controller.\r
- @retval other This device isn't supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Starts the device with this driver.\r
-\r
- @param This The 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
- @retval EFI_SUCCESS The controller is controlled by the driver.\r
- @retval Other This controller cannot be started.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Stop the device handled by this driver.\r
-\r
- @param This The 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_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
-BiosKeyboardDriverBindingStop (\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
- 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[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param Language[in] 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
-\r
- @param DriverName[out] 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
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\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
-BiosKeyboardComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\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[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] 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
-\r
- @param ChildHandle[in] 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
-\r
- @param Language[in] 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
-\r
- @param ControllerName[out] 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
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\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
-BiosKeyboardComponentNameGetControllerName (\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
-//\r
-// Simple Text Input Protocol functions\r
-//\r
-/**\r
- Reset the Keyboard and do BAT test for it, if (ExtendedVerification == TRUE) then do some extra keyboard validations.\r
-\r
- @param This Pointer of simple text Protocol.\r
- @param ExtendedVerification Whether perform the extra validation of keyboard. True: perform; FALSE: skip.\r
-\r
- @retval EFI_SUCCESS The command byte is written successfully.\r
- @retval EFI_DEVICE_ERROR Errors occurred during resetting keyboard.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardReset (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Read out the scan code of the key that has just been stroked.\r
-\r
- @param This Pointer of simple text Protocol.\r
- @param Key Pointer for store the key that read out.\r
-\r
- @retval EFI_SUCCESS The key is read out successfully.\r
- @retval other The key reading failed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardReadKeyStroke (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- OUT EFI_INPUT_KEY *Key\r
- );\r
-\r
-//\r
-// Private worker functions\r
-//\r
-/**\r
- Waiting on the keyboard event, if there's any key pressed by the user, signal the event\r
-\r
- @param Event The event that be siganlled when any key has been stroked.\r
- @param Context Pointer of the protocol EFI_SIMPLE_TEXT_INPUT_PROTOCOL.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BiosKeyboardWaitForKey (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-/**\r
- Check key buffer to get the key stroke status.\r
-\r
- @param This Pointer of the protocol EFI_SIMPLE_TEXT_IN_PROTOCOL.\r
-\r
- @retval EFI_SUCCESS A key is being pressed now.\r
- @retval Other No key is now pressed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardCheckForKey (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This\r
- );\r
-\r
-/**\r
- Convert unicode combined with scan code of key to the counterpart of EFIScancode of it.\r
-\r
- @param KeyChar Unicode of key.\r
- @param ScanCode Scan code of key.\r
-\r
- @return The value of EFI Scancode for the key.\r
- @retval SCAN_NULL No corresponding value in the EFI convert table is found for the key.\r
-\r
-**/\r
-UINT16\r
-ConvertToEFIScanCode (\r
- IN CHAR16 KeyChar,\r
- IN UINT16 ScanCode\r
- );\r
-\r
-/**\r
- Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command\r
- 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 BiosKeyboardPrivate Keyboard Private Data Struture\r
-\r
- @retval TRUE Keyboard in System.\r
- @retval FALSE Keyboard not in System.\r
-\r
-**/\r
-BOOLEAN\r
-CheckKeyboardConnect (\r
- IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate\r
- );\r
-\r
-/**\r
- Timer event handler: read a series of key stroke from 8042\r
- and put them into memory key buffer.\r
- It is registered as running under TPL_NOTIFY\r
-\r
- @param Event The timer event\r
- @param Context A BIOS_KEYBOARD_DEV pointer\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BiosKeyboardTimerHandler (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-/**\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
- Reset the input device and optionaly run diagnostics\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\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardResetEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\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
-\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
- @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
- hardware errors.\r
- @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardReadKeyStrokeEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- OUT EFI_KEY_DATA *KeyData\r
- );\r
-\r
-/**\r
- 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
- 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
- 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
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardSetState (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
- );\r
-\r
-/**\r
- 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. 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
-\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
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardRegisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_DATA *KeyData,\r
- IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\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 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.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BiosKeyboardUnregisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN VOID *NotificationHandle\r
- );\r
-\r
-/**\r
- Wait for a specific value to be presented in\r
- Data register of Keyboard Controller by keyboard and then read it,\r
- used in keyboard commands ack\r
-\r
- @param BiosKeyboardPrivate Keyboard instance pointer.\r
- @param Value The value to be waited for\r
- @param WaitForValueTimeOut The limit of microseconds for timeout\r
-\r
- @retval EFI_SUCCESS The command byte is written successfully.\r
- @retval EFI_TIMEOUT Timeout occurred during writing.\r
-\r
-**/\r
-EFI_STATUS\r
-KeyboardWaitForValue (\r
- IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate,\r
- IN UINT8 Value,\r
- IN UINTN WaitForValueTimeOut\r
- );\r
-\r
-/**\r
- Write data byte to input buffer or input/output ports of Keyboard Controller with delay and waiting for buffer-empty state.\r
-\r
- @param BiosKeyboardPrivate Keyboard instance pointer.\r
- @param Data Data byte to write.\r
-\r
- @retval EFI_SUCCESS The data byte is written successfully.\r
- @retval EFI_TIMEOUT Timeout occurred during writing.\r
-\r
-**/\r
-EFI_STATUS\r
-KeyboardWrite (\r
- IN BIOS_KEYBOARD_DEV *BiosKeyboardPrivate,\r
- IN UINT8 Data\r
- );\r
-\r
-/**\r
- Free keyboard notify list.\r
-\r
- @param ListHead The list head\r
-\r
- @retval EFI_SUCCESS Free the notify list successfully\r
- @retval EFI_INVALID_PARAMETER ListHead is invalid.\r
-\r
-**/\r
-EFI_STATUS\r
-BiosKeyboardFreeNotifyList (\r
- IN OUT LIST_ENTRY *ListHead\r
- );\r
-\r
-/**\r
- Check if key is registered.\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
- Waiting on the keyboard event, if there's any key pressed by the user, signal the event\r
-\r
- @param Event The event that be siganlled when any key has been stroked.\r
- @param Context Pointer of the protocol EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BiosKeyboardWaitForKeyEx (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-#endif\r
-\r