/** @file\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
\r
\r
#include <FrameworkDxe.h>\r
+#include <Pi/PiDxeCis.h>\r
\r
#include <Guid/StatusCodeDataTypeId.h>\r
#include <Protocol/SimpleTextIn.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
typedef struct _BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
UINTN Signature;\r
- EFI_HANDLE NotifyHandle;\r
EFI_KEY_DATA KeyData;\r
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
LIST_ENTRY NotifyEntry;\r
UINT16 StatusRegisterAddress;\r
UINT16 CommandRegisterAddress;\r
BOOLEAN ExtendedKeyboard;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- \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
+\r
} BIOS_KEYBOARD_DEV;\r
\r
#define BIOS_KEYBOARD_DEV_FROM_THIS(a) CR (a, BIOS_KEYBOARD_DEV, SimpleTextIn, BIOS_KEYBOARD_DEV_SIGNATURE)\r
driver specified by This was returned in\r
DriverName.\r
\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\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
@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 reseting keyboard.\r
+ @retval EFI_DEVICE_ERROR Errors occurred during resetting keyboard.\r
\r
**/\r
EFI_STATUS\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
+\r
@retval EFI_SUCCESS A key is being pressed now.\r
@retval Other No key is now pressed.\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
+ @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
/**\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
+ should not be in system.\r
\r
@param BiosKeyboardPrivate Keyboard Private Data Struture\r
\r
\r
/**\r
Timer event handler: read a series of key stroke from 8042\r
- and put them into memory key buffer. \r
+ and put them into memory key buffer.\r
It is registered as running under TPL_NOTIFY\r
- \r
+\r
@param Event The timer event\r
@param Context A BIOS_KEYBOARD_DEV pointer\r
\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
+\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
+ @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
not be reset.\r
\r
**/\r
);\r
\r
/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can \r
+ Reads the next keystroke from the input device. The WaitForKey Event can\r
be used to test for existance of a keystroke via WaitForEvent () call.\r
\r
@param This Protocol instance pointer.\r
- @param KeyData A pointer to a buffer that is filled in with the keystroke \r
+ @param KeyData A pointer to a buffer that is filled in with the keystroke\r
state data for the key that was pressed.\r
- \r
+\r
@retval EFI_SUCCESS The keystroke information was returned.\r
@retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keystroke information was not returned due to \r
+ @retval EFI_DEVICE_ERROR The keystroke information was not returned due to\r
hardware errors.\r
- @retval EFI_INVALID_PARAMETER KeyData is NULL. \r
- \r
+ @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
+\r
**/\r
EFI_STATUS\r
EFIAPI\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
+ @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
state for the input device.\r
\r
@retval EFI_SUCCESS The device state was set successfully.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and could \r
+ @retval EFI_DEVICE_ERROR The device is not functioning correctly and could\r
not have the setting adjusted.\r
@retval EFI_UNSUPPORTED The device does not have the ability to set its state.\r
- @retval EFI_INVALID_PARAMETER KeyToggleState is NULL. \r
+ @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r
\r
-**/ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosKeyboardSetState (\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.\r
- @param KeyNotificationFunction Points to the function to be called when the key \r
- sequence is typed specified by KeyData. \r
- @param NotifyHandle Points to the unique handle assigned to the registered notification. \r
+ @param KeyData A pointer to a buffer that is filled in with the keystroke\r
+ information data for the key that was pressed. If KeyData.Key,\r
+ KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState\r
+ are 0, then any incomplete keystroke will trigger a notification of\r
+ the KeyNotificationFunction.\r
+ @param KeyNotificationFunction Points to the function to be called when the key\r
+ sequence is typed specified by KeyData. This notification function\r
+ should be called at <=TPL_CALLBACK.\r
+ @param NotifyHandle Points to the unique handle assigned to the registered notification.\r
+\r
\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
+\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 EFI_HANDLE *NotifyHandle\r
+ OUT VOID **NotifyHandle\r
);\r
\r
/**\r
Remove a registered notification function from a particular keystroke.\r
\r
- @param This Protocol instance pointer. \r
+ @param This Protocol instance pointer.\r
@param NotificationHandle The handle of the notification function being unregistered.\r
- \r
+\r
@retval EFI_SUCCESS The notification function was unregistered successfully.\r
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.\r
- \r
-**/ \r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
BiosKeyboardUnregisterKeyNotify (\r
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_HANDLE NotificationHandle\r
+ IN VOID *NotificationHandle\r
);\r
\r
/**\r
EFI_STATUS\r
BiosKeyboardFreeNotifyList (\r
IN OUT LIST_ENTRY *ListHead\r
- ); \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
+ @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
+ @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
+ @retval FLASE Match failed.\r
+\r
**/\r
BOOLEAN\r
IsKeyRegistered (\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
**/\r
VOID\r
EFIAPI\r