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