]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModulePkg Ps2KeyboardDxe: Remove a redundant function
[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
896ae6fc 4Copyright (c) 2006 - 2018, 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
7863d11c 107 EFI_KEY_QUEUE EfiKeyQueueForNotify;\r
05fbd06d 108\r
109 //\r
110 // Error state\r
111 //\r
112 BOOLEAN KeyboardErr;\r
113\r
114 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
115\r
116 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
f3d1e940 117 //\r
118 // Notification Function List\r
119 //\r
120 LIST_ENTRY NotifyList;\r
7863d11c 121 EFI_EVENT KeyNotifyProcessEvent;\r
05fbd06d 122} KEYBOARD_CONSOLE_IN_DEV;\r
123\r
124#define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)\r
f3d1e940 125#define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) \\r
126 CR (a, \\r
127 KEYBOARD_CONSOLE_IN_DEV, \\r
128 ConInEx, \\r
129 KEYBOARD_CONSOLE_IN_DEV_SIGNATURE \\r
130 )\r
05fbd06d 131\r
132#define TABLE_END 0x0\r
133\r
05fbd06d 134//\r
135// Driver entry point\r
136//\r
bcd70414 137/**\r
138 The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r
139\r
5829afe3 140 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
bcd70414 141 @param[in] SystemTable A pointer to the EFI System Table.\r
5829afe3 142\r
bcd70414 143 @retval EFI_SUCCESS The entry point is executed successfully.\r
144 @retval other Some error occurs when executing this entry point.\r
145\r
146**/\r
05fbd06d 147EFI_STATUS\r
f3d1e940 148EFIAPI\r
05fbd06d 149InstallPs2KeyboardDriver (\r
150 IN EFI_HANDLE ImageHandle,\r
151 IN EFI_SYSTEM_TABLE *SystemTable\r
ed66e1bc 152 );\r
05fbd06d 153\r
154#define KEYBOARD_8042_DATA_REGISTER 0x60\r
155#define KEYBOARD_8042_STATUS_REGISTER 0x64\r
156#define KEYBOARD_8042_COMMAND_REGISTER 0x64\r
157\r
158#define KEYBOARD_KBEN 0xF4\r
159#define KEYBOARD_CMDECHO_ACK 0xFA\r
160\r
05f89b17 161#define KEYBOARD_MAX_TRY 256 // 256\r
05fbd06d 162#define KEYBOARD_TIMEOUT 65536 // 0.07s\r
163#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s\r
164#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s\r
165#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r
0d0bbc9f 166#define SCANCODE_EXTENDED0 0xE0\r
05fbd06d 167#define SCANCODE_EXTENDED1 0xE1\r
168#define SCANCODE_CTRL_MAKE 0x1D\r
169#define SCANCODE_CTRL_BREAK 0x9D\r
170#define SCANCODE_ALT_MAKE 0x38\r
171#define SCANCODE_ALT_BREAK 0xB8\r
172#define SCANCODE_LEFT_SHIFT_MAKE 0x2A\r
173#define SCANCODE_LEFT_SHIFT_BREAK 0xAA\r
174#define SCANCODE_RIGHT_SHIFT_MAKE 0x36\r
175#define SCANCODE_RIGHT_SHIFT_BREAK 0xB6\r
176#define SCANCODE_CAPS_LOCK_MAKE 0x3A\r
177#define SCANCODE_NUM_LOCK_MAKE 0x45\r
178#define SCANCODE_SCROLL_LOCK_MAKE 0x46\r
c220787b 179#define SCANCODE_DELETE_MAKE 0x53\r
f3d1e940 180#define SCANCODE_LEFT_LOGO_MAKE 0x5B //GUI key defined in Keyboard scan code\r
181#define SCANCODE_LEFT_LOGO_BREAK 0xDB\r
182#define SCANCODE_RIGHT_LOGO_MAKE 0x5C\r
183#define SCANCODE_RIGHT_LOGO_BREAK 0xDC\r
5829afe3 184#define SCANCODE_MENU_MAKE 0x5D //APPS key defined in Keyboard scan code\r
f3d1e940 185#define SCANCODE_MENU_BREAK 0xDD\r
186#define SCANCODE_SYS_REQ_MAKE 0x37\r
0d0bbc9f
RN
187#define SCANCODE_SYS_REQ_BREAK 0xB7\r
188#define SCANCODE_SYS_REQ_MAKE_WITH_ALT 0x54\r
189#define SCANCODE_SYS_REQ_BREAK_WITH_ALT 0xD4\r
190\r
f3d1e940 191#define SCANCODE_MAX_MAKE 0x60\r
05fbd06d 192\r
e8123186 193\r
b6763e03 194#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA BIT0 ///< 0 - Output register has no data; 1 - Output register has data\r
195#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA BIT1 ///< 0 - Input register has no data; 1 - Input register has data\r
196#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG BIT2 ///< Set to 0 after power on reset\r
197#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE BIT3 ///< 0 - Data in input register is data; 1 - Data in input register is command\r
198#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG BIT4 ///< 0 - Keyboard is disable; 1 - Keyboard is enable\r
199#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT BIT5 ///< 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete\r
200#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT BIT6 ///< 0 - Receive is complete without timeout; 1 - Receive is timeout without complete\r
201#define KEYBOARD_STATUS_REGISTER_PARITY BIT7 ///< 0 - Odd parity; 1 - Even parity\r
202\r
203#define KEYBOARD_8042_COMMAND_READ 0x20\r
204#define KEYBOARD_8042_COMMAND_WRITE 0x60\r
205#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE 0xA7\r
206#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE 0xA8\r
207#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST 0xAA\r
208#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST 0xAB\r
209#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE 0xAD\r
210\r
211#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA 0xF4\r
212#define KEYBOARD_8048_COMMAND_RESET 0xFF\r
213#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET 0xF0\r
214\r
215#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS 0xAA\r
216#define KEYBOARD_8048_RETURN_8042_BAT_ERROR 0xFC\r
217#define KEYBOARD_8048_RETURN_8042_ACK 0xFA\r
218\r
219\r
007c18f5 220//\r
221// Keyboard Controller Status\r
222//\r
223#define KBC_PARE 0x80 // Parity Error\r
224#define KBC_TIM 0x40 // General Time Out\r
225\r
05fbd06d 226//\r
227// Other functions that are used among .c files\r
228//\r
bcd70414 229/**\r
230 Show keyboard status lights according to\r
231 indicators in ConsoleIn.\r
232\r
233 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
5829afe3 234\r
bcd70414 235 @return status\r
f3d1e940 236\r
bcd70414 237**/\r
f3d1e940 238EFI_STATUS\r
239UpdateStatusLights (\r
240 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 241 );\r
f3d1e940 242\r
bcd70414 243/**\r
f713c4fe 244 write key to keyboard.\r
f3d1e940 245\r
bcd70414 246 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
247 @param Data value wanted to be written\r
f3d1e940 248\r
bcd70414 249 @retval EFI_TIMEOUT - GC_TODO: Add description for return value\r
250 @retval EFI_SUCCESS - GC_TODO: Add description for return value\r
f3d1e940 251\r
bcd70414 252**/\r
05fbd06d 253EFI_STATUS\r
254KeyboardRead (\r
255 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
256 OUT UINT8 *Data\r
ed66e1bc 257 );\r
05fbd06d 258\r
bcd70414 259/**\r
c220787b 260 Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.\r
05fbd06d 261\r
c220787b 262 The function is always called in TPL_NOTIFY.\r
05fbd06d 263\r
c220787b 264 @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r
05fbd06d 265\r
bcd70414 266**/\r
c220787b 267VOID\r
05fbd06d 268KeyGetchar (\r
269 IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 270 );\r
05fbd06d 271\r
7863d11c
SZ
272/**\r
273 Process key notify.\r
274\r
275 @param Event Indicates the event that invoke this function.\r
276 @param Context Indicates the calling context.\r
277**/\r
278VOID\r
279EFIAPI\r
280KeyNotifyProcessHandler (\r
281 IN EFI_EVENT Event,\r
282 IN VOID *Context\r
283 );\r
284\r
bcd70414 285/**\r
f713c4fe 286 Perform 8042 controller and keyboard Initialization.\r
bcd70414 287 If ExtendedVerification is TRUE, do additional test for\r
288 the keyboard interface\r
05fbd06d 289\r
bcd70414 290 @param ConsoleIn - KEYBOARD_CONSOLE_IN_DEV instance pointer\r
291 @param ExtendedVerification - indicates a thorough initialization\r
05fbd06d 292\r
bcd70414 293 @retval EFI_DEVICE_ERROR Fail to init keyboard\r
294 @retval EFI_SUCCESS Success to init keyboard\r
295**/\r
05fbd06d 296EFI_STATUS\r
297InitKeyboard (\r
298 IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
299 IN BOOLEAN ExtendedVerification\r
ed66e1bc 300 );\r
05fbd06d 301\r
05fbd06d 302\r
05fbd06d 303\r
bcd70414 304/**\r
305 Timer event handler: read a series of scancodes from 8042\r
306 and put them into memory scancode buffer.\r
307 it read as much scancodes to either fill\r
308 the memory buffer or empty the keyboard buffer.\r
309 It is registered as running under TPL_NOTIFY\r
05fbd06d 310\r
bcd70414 311 @param Event - The timer event\r
312 @param Context - A KEYBOARD_CONSOLE_IN_DEV pointer\r
05fbd06d 313\r
bcd70414 314**/\r
05fbd06d 315VOID\r
316EFIAPI\r
317KeyboardTimerHandler (\r
318 IN EFI_EVENT Event,\r
319 IN VOID *Context\r
ed66e1bc 320 );\r
05fbd06d 321\r
bcd70414 322/**\r
323 logic reset keyboard\r
324 Implement SIMPLE_TEXT_IN.Reset()\r
325 Perform 8042 controller and keyboard initialization\r
05fbd06d 326\r
bcd70414 327 @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
5829afe3 328 @param ExtendedVerification Indicate that the driver may perform a more\r
329 exhaustive verification operation of the device during\r
330 reset, now this par is ignored in this driver\r
05fbd06d 331\r
bcd70414 332**/\r
05fbd06d 333EFI_STATUS\r
334EFIAPI\r
335KeyboardEfiReset (\r
336 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
337 IN BOOLEAN ExtendedVerification\r
ed66e1bc 338 );\r
05fbd06d 339\r
bcd70414 340/**\r
341 Implement SIMPLE_TEXT_IN.ReadKeyStroke().\r
342 Retrieve key values for driver user.\r
05fbd06d 343\r
bcd70414 344 @param This Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
5829afe3 345 @param Key The output buffer for key value\r
05fbd06d 346\r
bcd70414 347 @retval EFI_SUCCESS success to read key stroke\r
348**/\r
05fbd06d 349EFI_STATUS\r
350EFIAPI\r
351KeyboardReadKeyStroke (\r
352 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
353 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 354 );\r
05fbd06d 355\r
bcd70414 356/**\r
357 Event notification function for SIMPLE_TEXT_IN.WaitForKey event\r
358 Signal the event if there is key available\r
05fbd06d 359\r
bcd70414 360 @param Event the event object\r
361 @param Context waitting context\r
05fbd06d 362\r
bcd70414 363**/\r
05fbd06d 364VOID\r
365EFIAPI\r
366KeyboardWaitForKey (\r
367 IN EFI_EVENT Event,\r
368 IN VOID *Context\r
ed66e1bc 369 );\r
05fbd06d 370\r
bcd70414 371/**\r
f713c4fe 372 Read status register.\r
05fbd06d 373\r
bcd70414 374 @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
05fbd06d 375\r
bcd70414 376 @return value in status register\r
05fbd06d 377\r
bcd70414 378**/\r
05fbd06d 379UINT8\r
380KeyReadStatusRegister (\r
381 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 382 );\r
05fbd06d 383\r
384/**\r
385 Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command\r
386 If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r
387 should not be in system.\r
388\r
f713c4fe 389 @param[in] ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
05fbd06d 390\r
f3d1e940 391 @retval TRUE Keyboard in System.\r
392 @retval FALSE Keyboard not in System.\r
05fbd06d 393**/\r
394BOOLEAN\r
395EFIAPI\r
396CheckKeyboardConnect (\r
397 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
ed66e1bc 398 );\r
f3d1e940 399\r
bcd70414 400/**\r
401 Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event\r
402 Signal the event if there is key available\r
403\r
404 @param Event event object\r
405 @param Context waiting context\r
406\r
407**/\r
f3d1e940 408VOID\r
409EFIAPI\r
410KeyboardWaitForKeyEx (\r
411 IN EFI_EVENT Event,\r
412 IN VOID *Context\r
5829afe3 413 );\r
f3d1e940 414\r
415//\r
416// Simple Text Input Ex protocol function prototypes\r
417//\r
418\r
bcd70414 419/**\r
420 Reset the input device and optionaly run diagnostics\r
421\r
422 @param This - Protocol instance pointer.\r
423 @param ExtendedVerification - Driver may perform diagnostics on reset.\r
424\r
425 @retval EFI_SUCCESS - The device was reset.\r
5829afe3 426 @retval EFI_DEVICE_ERROR - The device is not functioning properly and could\r
bcd70414 427 not be reset.\r
428\r
429**/\r
f3d1e940 430EFI_STATUS\r
431EFIAPI\r
432KeyboardEfiResetEx (\r
433 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
434 IN BOOLEAN ExtendedVerification\r
ed66e1bc 435 );\r
f3d1e940 436\r
bcd70414 437/**\r
5829afe3 438 Reads the next keystroke from the input device. The WaitForKey Event can\r
bcd70414 439 be used to test for existance of a keystroke via WaitForEvent () call.\r
f3d1e940 440\r
f3d1e940 441\r
bcd70414 442 @param This - Protocol instance pointer.\r
5829afe3 443 @param KeyData - A pointer to a buffer that is filled in with the keystroke\r
bcd70414 444 state data for the key that was pressed.\r
f3d1e940 445\r
bcd70414 446 @retval EFI_SUCCESS - The keystroke information was returned.\r
447 @retval EFI_NOT_READY - There was no keystroke data availiable.\r
5829afe3 448 @retval EFI_DEVICE_ERROR - The keystroke information was not returned due to\r
bcd70414 449 hardware errors.\r
5829afe3 450 @retval EFI_INVALID_PARAMETER - KeyData is NULL.\r
f3d1e940 451\r
bcd70414 452**/\r
f3d1e940 453EFI_STATUS\r
454EFIAPI\r
455KeyboardReadKeyStrokeEx (\r
456 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
457 OUT EFI_KEY_DATA *KeyData\r
ed66e1bc 458 );\r
f3d1e940 459\r
bcd70414 460/**\r
461 Set certain state for the input device.\r
f3d1e940 462\r
bcd70414 463 @param This - Protocol instance pointer.\r
5829afe3 464 @param KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
bcd70414 465 state for the input device.\r
f3d1e940 466\r
bcd70414 467 @retval EFI_SUCCESS - The device state was set successfully.\r
5829afe3 468 @retval EFI_DEVICE_ERROR - The device is not functioning correctly and could\r
bcd70414 469 not have the setting adjusted.\r
470 @retval EFI_UNSUPPORTED - The device does not have the ability to set its state.\r
5829afe3 471 @retval EFI_INVALID_PARAMETER - KeyToggleState is NULL.\r
f3d1e940 472\r
bcd70414 473**/\r
f3d1e940 474EFI_STATUS\r
475EFIAPI\r
476KeyboardSetState (\r
477 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
478 IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
ed66e1bc 479 );\r
f3d1e940 480\r
bcd70414 481/**\r
482 Register a notification function for a particular keystroke for the input device.\r
483\r
484 @param This - Protocol instance pointer.\r
5829afe3 485 @param KeyData - A pointer to a buffer that is filled in with the keystroke\r
cc9a430c
DB
486 information data for the key that was pressed. If KeyData.Key,\r
487 KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState\r
488 are 0, then any incomplete keystroke will trigger a notification of\r
489 the KeyNotificationFunction.\r
5829afe3 490 @param KeyNotificationFunction - Points to the function to be called when the key\r
cc9a430c
DB
491 sequence is typed specified by KeyData. This notification function\r
492 should be called at <=TPL_CALLBACK.\r
5829afe3 493 @param NotifyHandle - Points to the unique handle assigned to the registered notification.\r
bcd70414 494\r
495 @retval EFI_SUCCESS - The notification function was registered successfully.\r
496 @retval EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r
5829afe3 497 @retval EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.\r
498\r
499**/\r
f3d1e940 500EFI_STATUS\r
501EFIAPI\r
502KeyboardRegisterKeyNotify (\r
503 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
504 IN EFI_KEY_DATA *KeyData,\r
505 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
402e4a9d 506 OUT VOID **NotifyHandle\r
ed66e1bc 507 );\r
f3d1e940 508\r
bcd70414 509/**\r
510 Remove a registered notification function from a particular keystroke.\r
f3d1e940 511\r
5829afe3 512 @param This - Protocol instance pointer.\r
bcd70414 513 @param NotificationHandle - The handle of the notification function being unregistered.\r
f3d1e940 514\r
5829afe3 515\r
bcd70414 516 @retval EFI_SUCCESS - The notification function was unregistered successfully.\r
517 @retval EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r
5829afe3 518 @retval EFI_NOT_FOUND - Can not find the matching entry in database.\r
519\r
520**/\r
f3d1e940 521EFI_STATUS\r
522EFIAPI\r
523KeyboardUnregisterKeyNotify (\r
524 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
402e4a9d 525 IN VOID *NotificationHandle\r
ed66e1bc 526 );\r
f3d1e940 527\r
c220787b
RN
528/**\r
529 Push one key data to the EFI key buffer.\r
530\r
531 @param Queue Pointer to instance of EFI_KEY_QUEUE.\r
532 @param KeyData The key data to push.\r
533**/\r
534VOID\r
535PushEfikeyBufTail (\r
536 IN EFI_KEY_QUEUE *Queue,\r
537 IN EFI_KEY_DATA *KeyData\r
538 );\r
539\r
540/**\r
541 Judge whether is a registed key\r
542\r
5829afe3 543 @param RegsiteredData A pointer to a buffer that is filled in with the keystroke\r
c220787b 544 state data for the key that was registered.\r
5829afe3 545 @param InputData A pointer to a buffer that is filled in with the keystroke\r
c220787b
RN
546 state data for the key that was pressed.\r
547\r
548 @retval TRUE Key be pressed matches a registered key.\r
5829afe3 549 @retval FLASE Match failed.\r
550\r
c220787b
RN
551**/\r
552BOOLEAN\r
553IsKeyRegistered (\r
554 IN EFI_KEY_DATA *RegsiteredData,\r
555 IN EFI_KEY_DATA *InputData\r
556 );\r
5829afe3 557\r
896ae6fc
RN
558/**\r
559 Initialize the key state.\r
560\r
561 @param ConsoleIn The KEYBOARD_CONSOLE_IN_DEV instance.\r
562 @param KeyState A pointer to receive the key state information.\r
563**/\r
564VOID\r
565InitializeKeyState (\r
566 IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
567 OUT EFI_KEY_STATE *KeyState\r
568 );\r
569\r
05fbd06d 570#endif\r