25 return (BOOLEAN)(Queue->Head == Queue->Tail);
50 if (KeyData !=
NULL) {
54 Queue->Head = (Queue->Head + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;
70 if ((Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT == Queue->Head) {
78 Queue->Tail = (Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;
100 ASSERT (RegsiteredData !=
NULL && InputData !=
NULL);
102 if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
103 (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar))
111 if ((RegsiteredData->KeyState.KeyShiftState != 0) &&
112 (RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState))
117 if ((RegsiteredData->KeyState.KeyToggleState != 0) &&
118 (RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState))
152 if (KeyData ==
NULL) {
153 return EFI_INVALID_PARAMETER;
159 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
163 if (ConsoleInDev->KeyboardErr) {
164 Status = EFI_DEVICE_ERROR;
167 if (Status == EFI_NOT_READY) {
168 ZeroMem (&KeyData->Key, sizeof (KeyData->Key));
173 gBS->RestoreTPL (OldTpl);
190 IN BOOLEAN ExtendedVerification
197 ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
198 if (ConsoleIn->KeyboardErr) {
199 return EFI_DEVICE_ERROR;
204 EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET,
205 ConsoleIn->DevicePath
211 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
216 Status =
InitKeyboard (ConsoleIn, ExtendedVerification);
217 if (EFI_ERROR (Status)) {
221 gBS->RestoreTPL (OldTpl);
222 return EFI_DEVICE_ERROR;
228 gBS->RestoreTPL (OldTpl);
236 EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_EC_STUCK_KEY,
237 ConsoleIn->DevicePath
248 ConsoleIn->DevicePath
275 ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
287 if (EFI_ERROR (Status)) {
294 if ((KeyData.
Key.ScanCode == SCAN_NULL) && (KeyData.
Key.UnicodeChar == CHAR_NULL)) {
302 if ((KeyData.
KeyState.
KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) {
303 if ((KeyData.
Key.UnicodeChar >= L
'a') && (KeyData.
Key.UnicodeChar <= L
'z')) {
304 KeyData.
Key.UnicodeChar = (CHAR16)(KeyData.
Key.UnicodeChar - L
'a' + 1);
305 }
else if ((KeyData.
Key.UnicodeChar >= L
'A') && (KeyData.
Key.UnicodeChar <= L
'Z')) {
306 KeyData.
Key.UnicodeChar = (CHAR16)(KeyData.
Key.UnicodeChar - L
'A' + 1);
339 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
343 if (!ConsoleIn->KeyboardErr) {
353 &(ConsoleIn->EfiKeyQueue.Buffer[ConsoleIn->EfiKeyQueue.Head]),
356 if ((KeyData.
Key.ScanCode == SCAN_NULL) && (KeyData.
Key.UnicodeChar == CHAR_NULL)) {
364 gBS->SignalEvent (Event);
372 gBS->RestoreTPL (OldTpl);
409 IN BOOLEAN ExtendedVerification
415 ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
417 return ConsoleInDev->ConIn.Reset (
418 &ConsoleInDev->ConIn,
450 if (KeyData ==
NULL) {
451 return EFI_INVALID_PARAMETER;
454 ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
484 if (KeyToggleState ==
NULL) {
485 return EFI_INVALID_PARAMETER;
488 ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
493 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
495 if (ConsoleInDev->KeyboardErr) {
496 Status = EFI_DEVICE_ERROR;
500 if ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) {
501 Status = EFI_UNSUPPORTED;
508 ConsoleInDev->ScrollLock =
FALSE;
509 ConsoleInDev->NumLock =
FALSE;
510 ConsoleInDev->CapsLock =
FALSE;
511 ConsoleInDev->IsSupportPartialKey =
FALSE;
513 if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
514 ConsoleInDev->ScrollLock =
TRUE;
517 if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
518 ConsoleInDev->NumLock =
TRUE;
521 if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
522 ConsoleInDev->CapsLock =
TRUE;
525 if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
526 ConsoleInDev->IsSupportPartialKey =
TRUE;
530 if (EFI_ERROR (Status)) {
531 Status = EFI_DEVICE_ERROR;
538 gBS->RestoreTPL (OldTpl);
567 OUT VOID **NotifyHandle
577 if ((KeyData ==
NULL) || (NotifyHandle ==
NULL) || (KeyNotificationFunction ==
NULL)) {
578 return EFI_INVALID_PARAMETER;
581 ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
586 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
591 for (Link = ConsoleInDev->NotifyList.ForwardLink; Link != &ConsoleInDev->NotifyList; Link = Link->ForwardLink) {
596 KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE
599 if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {
600 *NotifyHandle = CurrentNotify;
611 if (NewNotify ==
NULL) {
612 Status = EFI_OUT_OF_RESOURCES;
616 NewNotify->Signature = KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE;
617 NewNotify->KeyNotificationFn = KeyNotificationFunction;
619 InsertTailList (&ConsoleInDev->NotifyList, &NewNotify->NotifyEntry);
621 *NotifyHandle = NewNotify;
628 gBS->RestoreTPL (OldTpl);
647 IN VOID *NotificationHandle
656 if (NotificationHandle ==
NULL) {
657 return EFI_INVALID_PARAMETER;
660 ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);
665 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
667 for (Link = ConsoleInDev->NotifyList.ForwardLink; Link != &ConsoleInDev->NotifyList; Link = Link->ForwardLink) {
672 KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE
674 if (CurrentNotify == NotificationHandle) {
680 gBS->FreePool (CurrentNotify);
689 Status = EFI_INVALID_PARAMETER;
694 gBS->RestoreTPL (OldTpl);
724 NotifyList = &ConsoleIn->NotifyList;
729 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
734 gBS->RestoreTPL (OldTpl);
735 if (EFI_ERROR (Status)) {
742 CurrentNotify->KeyNotificationFn (&KeyData);
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define CR(Record, TYPE, Field, TestSignature)
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define EFI_P_KEYBOARD_EC_LOCKED
#define EFI_PROGRESS_CODE
UINT8 KeyReadStatusRegister(IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
VOID EFIAPI KeyboardTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS UpdateStatusLights(IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
EFI_STATUS InitKeyboard(IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI KeyboardReadKeyStrokeEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
VOID EFIAPI KeyNotifyProcessHandler(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI KeyboardEfiResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI KeyboardSetState(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState)
EFI_STATUS EFIAPI KeyboardEfiReset(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI KeyboardReadKeyStroke(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, OUT EFI_INPUT_KEY *Key)
VOID PushEfikeyBufTail(IN EFI_KEY_QUEUE *Queue, IN EFI_KEY_DATA *KeyData)
EFI_STATUS KeyboardReadKeyStrokeWorker(IN KEYBOARD_CONSOLE_IN_DEV *ConsoleInDev, OUT EFI_KEY_DATA *KeyData)
VOID EFIAPI KeyboardWaitForKeyEx(IN EFI_EVENT Event, IN VOID *Context)
BOOLEAN IsEfikeyBufEmpty(IN EFI_KEY_QUEUE *Queue)
EFI_STATUS PopEfikeyBufHead(IN EFI_KEY_QUEUE *Queue, OUT EFI_KEY_DATA *KeyData OPTIONAL)
EFI_STATUS EFIAPI KeyboardUnregisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle)
EFI_STATUS EFIAPI KeyboardRegisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT VOID **NotifyHandle)
BOOLEAN IsKeyRegistered(IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)
VOID EFIAPI KeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context)
UINT8 EFI_KEY_TOGGLE_STATE
EFI_STATUS(EFIAPI * EFI_KEY_NOTIFY_FUNCTION)(IN EFI_KEY_DATA *KeyData)
VOID EFIAPI Exit(IN EFI_STATUS Status)