]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModulePkg/Ps2Kbd: use PCD/Protocol in MdeModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.h
CommitLineData
f713c4fe 1/** @file\r
f3d1e940 2 PS/2 keyboard driver header file\r
05fbd06d 3\r
265dd403 4Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
180a5a35 5This program and the accompanying materials\r
df0dcb5e 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
05fbd06d 12\r
13**/\r
14\r
f713c4fe 15#ifndef _PS2KEYBOARD_H_\r
16#define _PS2KEYBOARD_H_\r
05fbd06d 17\r
265dd403 18#include <Uefi.h>\r
752f2e26 19\r
20#include <Protocol/SimpleTextIn.h>\r
f3d1e940 21#include <Protocol/SimpleTextInEx.h>\r
752f2e26 22#include <Protocol/IsaIo.h>\r
23#include <Protocol/DevicePath.h>\r
24#include <Protocol/Ps2Policy.h>\r
25\r
26#include <Library/UefiDriverEntryPoint.h>\r
27#include <Library/UefiLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/ReportStatusCodeLib.h>\r
30#include <Library/DebugLib.h>\r
31#include <Library/UefiRuntimeServicesTableLib.h>\r
32#include <Library/MemoryAllocationLib.h>\r
f3d1e940 33#include <Library/BaseLib.h>\r
34#include <Library/BaseMemoryLib.h>\r
b6763e03 35#include <Library/TimerLib.h>\r
f6c014fb 36#include <Library/PcdLib.h>\r
05fbd06d 37\r
9f6531d1 38//\r
39// Global Variables\r
40//\r
41extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver;\r
42extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName;\r
43extern EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2;\r
44\r
05fbd06d 45//\r
46// Driver Private Data\r
47//\r
c220787b 48#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE SIGNATURE_32 ('k', 'k', 'e', 'y')\r
f02bd376 49#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('k', 'c', 'e', 'n')\r
f3d1e940 50\r
51typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
c220787b 52 UINTN Signature;\r
c220787b
RN
53 EFI_KEY_DATA KeyData;\r
54 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
55 LIST_ENTRY NotifyEntry;\r
f3d1e940 56} KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
57\r
c220787b
RN
58#define KEYBOARD_SCAN_CODE_MAX_COUNT 32\r
59typedef struct {\r
60 UINT8 Buffer[KEYBOARD_SCAN_CODE_MAX_COUNT];\r
61 UINTN Head;\r
62 UINTN Tail;\r
63} SCAN_CODE_QUEUE;\r
64\r
65#define KEYBOARD_EFI_KEY_MAX_COUNT 256\r
66typedef struct {\r
67 EFI_KEY_DATA Buffer[KEYBOARD_EFI_KEY_MAX_COUNT];\r
68 UINTN Head;\r
69 UINTN Tail;\r
70} EFI_KEY_QUEUE;\r
05fbd06d 71\r
72typedef struct {\r
73 UINTN Signature;\r
74\r
75 EFI_HANDLE Handle;\r
76 EFI_SIMPLE_TEXT_INPUT_PROTOCOL ConIn;\r
f3d1e940 77 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL ConInEx;\r
05fbd06d 78 EFI_ISA_IO_PROTOCOL *IsaIo;\r
79\r
80 EFI_EVENT TimerEvent;\r
81\r
82 UINT32 DataRegisterAddress;\r
83 UINT32 StatusRegisterAddress;\r
84 UINT32 CommandRegisterAddress;\r
85\r
0d0bbc9f
RN
86 BOOLEAN LeftCtrl;\r
87 BOOLEAN RightCtrl;\r
88 BOOLEAN LeftAlt;\r
89 BOOLEAN RightAlt;\r
f3d1e940 90 BOOLEAN LeftShift;\r
5829afe3 91 BOOLEAN RightShift;\r
f3d1e940 92 BOOLEAN LeftLogo;\r
93 BOOLEAN RightLogo;\r
94 BOOLEAN Menu;\r
95 BOOLEAN SysReq;\r
05fbd06d 96\r
05fbd06d 97 BOOLEAN CapsLock;\r
98 BOOLEAN NumLock;\r
99 BOOLEAN ScrollLock;\r
100\r
5829afe3 101 BOOLEAN IsSupportPartialKey;\r
05fbd06d 102 //\r
c220787b 103 // Queue storing key scancodes\r
05fbd06d 104 //\r
c220787b
RN
105 SCAN_CODE_QUEUE ScancodeQueue;\r
106 EFI_KEY_QUEUE EfiKeyQueue;\r
05fbd06d 107\r
108 //\r
109 // Error state\r
110 //\r
111 BOOLEAN KeyboardErr;\r
112\r
113 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
114\r
115 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
f3d1e940 116 //\r
117 // Notification Function List\r
118 //\r
119 LIST_ENTRY NotifyList;\r
05fbd06d 120} KEYBOARD_CONSOLE_IN_DEV;\r
121\r
122#define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)\r
f3d1e940 123#define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) \\r
124 CR (a, \\r
125 KEYBOARD_CONSOLE_IN_DEV, \\r
126 ConInEx, \\r
127 KEYBOARD_CONSOLE_IN_DEV_SIGNATURE \\r
128 )\r
05fbd06d 129\r
130#define TABLE_END 0x0\r
131\r
05fbd06d 132//\r
133// Driver entry point\r
134//\r
bcd70414 135/**\r
136 The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r
137\r
5829afe3 138 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
bcd70414 139 @param[in] SystemTable A pointer to the EFI System Table.\r
5829afe3 140\r
bcd70414 141 @retval EFI_SUCCESS The entry point is executed successfully.\r
142 @retval other Some error occurs when executing this entry point.\r
143\r
144**/\r
05fbd06d 145EFI_STATUS\r
f3d1e940 146EFIAPI\r
05fbd06d 147InstallPs2KeyboardDriver (\r
148 IN EFI_HANDLE ImageHandle,\r
149 IN EFI_SYSTEM_TABLE *SystemTable\r
ed66e1bc 150 );\r
05fbd06d 151\r
152#define KEYBOARD_8042_DATA_REGISTER 0x60\r
153#define KEYBOARD_8042_STATUS_REGISTER 0x64\r
154#define KEYBOARD_8042_COMMAND_REGISTER 0x64\r
155\r
156#define KEYBOARD_KBEN 0xF4\r
157#define KEYBOARD_CMDECHO_ACK 0xFA\r
158\r
05f89b17 159#define KEYBOARD_MAX_TRY 256 // 256\r
05fbd06d 160#define KEYBOARD_TIMEOUT 65536 // 0.07s\r
161#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s\r
162#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s\r
163#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r
0d0bbc9f 164#define SCANCODE_EXTENDED0 0xE0\r
05fbd06d 165#define SCANCODE_EXTENDED1 0xE1\r
166#define SCANCODE_CTRL_MAKE 0x1D\r
167#define SCANCODE_CTRL_BREAK 0x9D\r
168#define SCANCODE_ALT_MAKE 0x38\r
169#define SCANCODE_ALT_BREAK 0xB8\r
170#define SCANCODE_LEFT_SHIFT_MAKE 0x2A\r
171#define SCANCODE_LEFT_SHIFT_BREAK 0xAA\r
172#define SCANCODE_RIGHT_SHIFT_MAKE 0x36\r
173#define SCANCODE_RIGHT_SHIFT_BREAK 0xB6\r
174#define SCANCODE_CAPS_LOCK_MAKE 0x3A\r
175#define SCANCODE_NUM_LOCK_MAKE 0x45\r
176#define SCANCODE_SCROLL_LOCK_MAKE 0x46\r
c220787b 177#define SCANCODE_DELETE_MAKE 0x53\r
f3d1e940 178#define SCANCODE_LEFT_LOGO_MAKE 0x5B //GUI key defined in Keyboard scan code\r
179#define SCANCODE_LEFT_LOGO_BREAK 0xDB\r
180#define SCANCODE_RIGHT_LOGO_MAKE 0x5C\r
181#define SCANCODE_RIGHT_LOGO_BREAK 0xDC\r
5829afe3 182#define SCANCODE_MENU_MAKE 0x5D //APPS key defined in Keyboard scan code\r
f3d1e940 183#define SCANCODE_MENU_BREAK 0xDD\r
184#define SCANCODE_SYS_REQ_MAKE 0x37\r
0d0bbc9f
RN
185#define SCANCODE_SYS_REQ_BREAK 0xB7\r
186#define SCANCODE_SYS_REQ_MAKE_WITH_ALT 0x54\r
187#define SCANCODE_SYS_REQ_BREAK_WITH_ALT 0xD4\r
188\r
f3d1e940 189#define SCANCODE_MAX_MAKE 0x60\r
05fbd06d 190\r
e8123186 191\r
b6763e03 192#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA BIT0 ///< 0 - Output register has no data; 1 - Output register has data\r
193#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA BIT1 ///< 0 - Input register has no data; 1 - Input register has data\r
194#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG BIT2 ///< Set to 0 after power on reset\r
195#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE BIT3 ///< 0 - Data in input register is data; 1 - Data in input register is command\r
196#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG BIT4 ///< 0 - Keyboard is disable; 1 - Keyboard is enable\r
197#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT BIT5 ///< 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete\r
198#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT BIT6 ///< 0 - Receive is complete without timeout; 1 - Receive is timeout without complete\r
199#define KEYBOARD_STATUS_REGISTER_PARITY BIT7 ///< 0 - Odd parity; 1 - Even parity\r
200\r
201#define KEYBOARD_8042_COMMAND_READ 0x20\r
202#define KEYBOARD_8042_COMMAND_WRITE 0x60\r
203#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE 0xA7\r
204#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE 0xA8\r
205#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST 0xAA\r
206#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST 0xAB\r
207#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE 0xAD\r
208\r
209#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA 0xF4\r
210#define KEYBOARD_8048_COMMAND_RESET 0xFF\r
211#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET 0xF0\r
212\r
213#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS 0xAA\r
214#define KEYBOARD_8048_RETURN_8042_BAT_ERROR 0xFC\r
215#define KEYBOARD_8048_RETURN_8042_ACK 0xFA\r
216\r
217\r
007c18f5 218//\r
219// Keyboard Controller Status\r
220//\r
221#define KBC_PARE 0x80 // Parity Error\r
222#define KBC_TIM 0x40 // General Time Out\r
223\r
05fbd06d 224//\r
225// Other functions that are used among .c files\r
226//\r
bcd70414 227/**\r
228 Show keyboard status lights according to\r
229 indicators in ConsoleIn.\r
230\r
231 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
5829afe3 232\r
bcd70414 233 @return status\r
f3d1e940 234\r
bcd70414 235**/\r
f3d1e940 236EFI_STATUS\r
237UpdateStatusLights (\r
238 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 239 );\r
f3d1e940 240\r
bcd70414 241/**\r
f713c4fe 242 write key to keyboard.\r
f3d1e940 243\r
bcd70414 244 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
245 @param Data value wanted to be written\r
f3d1e940 246\r
bcd70414 247 @retval EFI_TIMEOUT - GC_TODO: Add description for return value\r
248 @retval EFI_SUCCESS - GC_TODO: Add description for return value\r
f3d1e940 249\r
bcd70414 250**/\r
05fbd06d 251EFI_STATUS\r
252KeyboardRead (\r
253 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
254 OUT UINT8 *Data\r
ed66e1bc 255 );\r
05fbd06d 256\r
bcd70414 257/**\r
c220787b 258 Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.\r
05fbd06d 259\r
c220787b 260 The function is always called in TPL_NOTIFY.\r
05fbd06d 261\r
c220787b 262 @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r
05fbd06d 263\r
bcd70414 264**/\r
c220787b 265VOID\r
05fbd06d 266KeyGetchar (\r
267 IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 268 );\r
05fbd06d 269\r
bcd70414 270/**\r
f713c4fe 271 Perform 8042 controller and keyboard Initialization.\r
bcd70414 272 If ExtendedVerification is TRUE, do additional test for\r
273 the keyboard interface\r
05fbd06d 274\r
bcd70414 275 @param ConsoleIn - KEYBOARD_CONSOLE_IN_DEV instance pointer\r
276 @param ExtendedVerification - indicates a thorough initialization\r
05fbd06d 277\r
bcd70414 278 @retval EFI_DEVICE_ERROR Fail to init keyboard\r
279 @retval EFI_SUCCESS Success to init keyboard\r
280**/\r
05fbd06d 281EFI_STATUS\r
282InitKeyboard (\r
283 IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
284 IN BOOLEAN ExtendedVerification\r
ed66e1bc 285 );\r
05fbd06d 286\r
bcd70414 287/**\r
f713c4fe 288 Disable the keyboard interface of the 8042 controller.\r
05fbd06d 289\r
bcd70414 290 @param ConsoleIn - the device instance\r
05fbd06d 291\r
bcd70414 292 @return status of issuing disable command\r
05fbd06d 293\r
bcd70414 294**/\r
05fbd06d 295EFI_STATUS\r
296DisableKeyboard (\r
297 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 298 );\r
05fbd06d 299\r
bcd70414 300/**\r
301 Timer event handler: read a series of scancodes from 8042\r
302 and put them into memory scancode buffer.\r
303 it read as much scancodes to either fill\r
304 the memory buffer or empty the keyboard buffer.\r
305 It is registered as running under TPL_NOTIFY\r
05fbd06d 306\r
bcd70414 307 @param Event - The timer event\r
308 @param Context - A KEYBOARD_CONSOLE_IN_DEV pointer\r
05fbd06d 309\r
bcd70414 310**/\r
05fbd06d 311VOID\r
312EFIAPI\r
313KeyboardTimerHandler (\r
314 IN EFI_EVENT Event,\r
315 IN VOID *Context\r
ed66e1bc 316 );\r
05fbd06d 317\r
bcd70414 318/**\r
319 logic reset keyboard\r
320 Implement SIMPLE_TEXT_IN.Reset()\r
321 Perform 8042 controller and keyboard initialization\r
05fbd06d 322\r
bcd70414 323 @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
5829afe3 324 @param ExtendedVerification Indicate that the driver may perform a more\r
325 exhaustive verification operation of the device during\r
326 reset, now this par is ignored in this driver\r
05fbd06d 327\r
bcd70414 328**/\r
05fbd06d 329EFI_STATUS\r
330EFIAPI\r
331KeyboardEfiReset (\r
332 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
333 IN BOOLEAN ExtendedVerification\r
ed66e1bc 334 );\r
05fbd06d 335\r
bcd70414 336/**\r
337 Implement SIMPLE_TEXT_IN.ReadKeyStroke().\r
338 Retrieve key values for driver user.\r
05fbd06d 339\r
bcd70414 340 @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
5829afe3 341 @param Key The output buffer for key value\r
05fbd06d 342\r
bcd70414 343 @retval EFI_SUCCESS success to read key stroke\r
344**/\r
05fbd06d 345EFI_STATUS\r
346EFIAPI\r
347KeyboardReadKeyStroke (\r
348 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
349 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 350 );\r
05fbd06d 351\r
bcd70414 352/**\r
353 Event notification function for SIMPLE_TEXT_IN.WaitForKey event\r
354 Signal the event if there is key available\r
05fbd06d 355\r
bcd70414 356 @param Event the event object\r
357 @param Context waitting context\r
05fbd06d 358\r
bcd70414 359**/\r
05fbd06d 360VOID\r
361EFIAPI\r
362KeyboardWaitForKey (\r
363 IN EFI_EVENT Event,\r
364 IN VOID *Context\r
ed66e1bc 365 );\r
05fbd06d 366\r
bcd70414 367/**\r
f713c4fe 368 Read status register.\r
05fbd06d 369\r
bcd70414 370 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
05fbd06d 371\r
bcd70414 372 @return value in status register\r
05fbd06d 373\r
bcd70414 374**/\r
05fbd06d 375UINT8\r
376KeyReadStatusRegister (\r
377 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 378 );\r
05fbd06d 379\r
380/**\r
381 Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command\r
382 If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r
383 should not be in system.\r
384\r
f713c4fe 385 @param[in] ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
05fbd06d 386\r
f3d1e940 387 @retval TRUE Keyboard in System.\r
388 @retval FALSE Keyboard not in System.\r
05fbd06d 389**/\r
390BOOLEAN\r
391EFIAPI\r
392CheckKeyboardConnect (\r
393 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 394 );\r
f3d1e940 395\r
bcd70414 396/**\r
397 Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event\r
398 Signal the event if there is key available\r
399\r
400 @param Event event object\r
401 @param Context waiting context\r
402\r
403**/\r
f3d1e940 404VOID\r
405EFIAPI\r
406KeyboardWaitForKeyEx (\r
407 IN EFI_EVENT Event,\r
408 IN VOID *Context\r
5829afe3 409 );\r
f3d1e940 410\r
411//\r
412// Simple Text Input Ex protocol function prototypes\r
413//\r
414\r
bcd70414 415/**\r
416 Reset the input device and optionaly run diagnostics\r
417\r
418 @param This - Protocol instance pointer.\r
419 @param ExtendedVerification - Driver may perform diagnostics on reset.\r
420\r
421 @retval EFI_SUCCESS - The device was reset.\r
5829afe3 422 @retval EFI_DEVICE_ERROR - The device is not functioning properly and could\r
bcd70414 423 not be reset.\r
424\r
425**/\r
f3d1e940 426EFI_STATUS\r
427EFIAPI\r
428KeyboardEfiResetEx (\r
429 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
430 IN BOOLEAN ExtendedVerification\r
ed66e1bc 431 );\r
f3d1e940 432\r
bcd70414 433/**\r
5829afe3 434 Reads the next keystroke from the input device. The WaitForKey Event can\r
bcd70414 435 be used to test for existance of a keystroke via WaitForEvent () call.\r
f3d1e940 436\r
f3d1e940 437\r
bcd70414 438 @param This - Protocol instance pointer.\r
5829afe3 439 @param KeyData - A pointer to a buffer that is filled in with the keystroke\r
bcd70414 440 state data for the key that was pressed.\r
f3d1e940 441\r
bcd70414 442 @retval EFI_SUCCESS - The keystroke information was returned.\r
443 @retval EFI_NOT_READY - There was no keystroke data availiable.\r
5829afe3 444 @retval EFI_DEVICE_ERROR - The keystroke information was not returned due to\r
bcd70414 445 hardware errors.\r
5829afe3 446 @retval EFI_INVALID_PARAMETER - KeyData is NULL.\r
f3d1e940 447\r
bcd70414 448**/\r
f3d1e940 449EFI_STATUS\r
450EFIAPI\r
451KeyboardReadKeyStrokeEx (\r
452 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
453 OUT EFI_KEY_DATA *KeyData\r
ed66e1bc 454 );\r
f3d1e940 455\r
bcd70414 456/**\r
457 Set certain state for the input device.\r
f3d1e940 458\r
bcd70414 459 @param This - Protocol instance pointer.\r
5829afe3 460 @param KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
bcd70414 461 state for the input device.\r
f3d1e940 462\r
bcd70414 463 @retval EFI_SUCCESS - The device state was set successfully.\r
5829afe3 464 @retval EFI_DEVICE_ERROR - The device is not functioning correctly and could\r
bcd70414 465 not have the setting adjusted.\r
466 @retval EFI_UNSUPPORTED - The device does not have the ability to set its state.\r
5829afe3 467 @retval EFI_INVALID_PARAMETER - KeyToggleState is NULL.\r
f3d1e940 468\r
bcd70414 469**/\r
f3d1e940 470EFI_STATUS\r
471EFIAPI\r
472KeyboardSetState (\r
473 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
474 IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
ed66e1bc 475 );\r
f3d1e940 476\r
bcd70414 477/**\r
478 Register a notification function for a particular keystroke for the input device.\r
479\r
480 @param This - Protocol instance pointer.\r
5829afe3 481 @param KeyData - A pointer to a buffer that is filled in with the keystroke\r
bcd70414 482 information data for the key that was pressed.\r
5829afe3 483 @param KeyNotificationFunction - Points to the function to be called when the key\r
484 sequence is typed specified by KeyData.\r
485 @param NotifyHandle - Points to the unique handle assigned to the registered notification.\r
bcd70414 486\r
487 @retval EFI_SUCCESS - The notification function was registered successfully.\r
488 @retval EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r
5829afe3 489 @retval EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.\r
490\r
491**/\r
f3d1e940 492EFI_STATUS\r
493EFIAPI\r
494KeyboardRegisterKeyNotify (\r
495 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
496 IN EFI_KEY_DATA *KeyData,\r
497 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
402e4a9d 498 OUT VOID **NotifyHandle\r
ed66e1bc 499 );\r
f3d1e940 500\r
bcd70414 501/**\r
502 Remove a registered notification function from a particular keystroke.\r
f3d1e940 503\r
5829afe3 504 @param This - Protocol instance pointer.\r
bcd70414 505 @param NotificationHandle - The handle of the notification function being unregistered.\r
f3d1e940 506\r
5829afe3 507\r
bcd70414 508 @retval EFI_SUCCESS - The notification function was unregistered successfully.\r
509 @retval EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r
5829afe3 510 @retval EFI_NOT_FOUND - Can not find the matching entry in database.\r
511\r
512**/\r
f3d1e940 513EFI_STATUS\r
514EFIAPI\r
515KeyboardUnregisterKeyNotify (\r
516 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
402e4a9d 517 IN VOID *NotificationHandle\r
ed66e1bc 518 );\r
f3d1e940 519\r
c220787b
RN
520/**\r
521 Push one key data to the EFI key buffer.\r
522\r
523 @param Queue Pointer to instance of EFI_KEY_QUEUE.\r
524 @param KeyData The key data to push.\r
525**/\r
526VOID\r
527PushEfikeyBufTail (\r
528 IN EFI_KEY_QUEUE *Queue,\r
529 IN EFI_KEY_DATA *KeyData\r
530 );\r
531\r
532/**\r
533 Judge whether is a registed key\r
534\r
5829afe3 535 @param RegsiteredData A pointer to a buffer that is filled in with the keystroke\r
c220787b 536 state data for the key that was registered.\r
5829afe3 537 @param InputData A pointer to a buffer that is filled in with the keystroke\r
c220787b
RN
538 state data for the key that was pressed.\r
539\r
540 @retval TRUE Key be pressed matches a registered key.\r
5829afe3 541 @retval FLASE Match failed.\r
542\r
c220787b
RN
543**/\r
544BOOLEAN\r
545IsKeyRegistered (\r
546 IN EFI_KEY_DATA *RegsiteredData,\r
547 IN EFI_KEY_DATA *InputData\r
548 );\r
5829afe3 549\r
05fbd06d 550#endif\r