126 Status =
gBS->OpenProtocol (
128 &gEfiDevicePathProtocolGuid,
129 (VOID **)&DevicePath,
130 This->DriverBindingHandle,
132 EFI_OPEN_PROTOCOL_GET_PROTOCOL
134 if (EFI_ERROR (Status)) {
146 return EFI_UNSUPPORTED;
149 if ((Acpi->
HID != EISA_PNP_ID (0x303)) || (Acpi->
UID != 0)) {
150 return EFI_UNSUPPORTED;
156 Status =
gBS->OpenProtocol (
158 &gEfiSioProtocolGuid,
160 This->DriverBindingHandle,
162 EFI_OPEN_PROTOCOL_BY_DRIVER
164 if (EFI_ERROR (Status)) {
173 &gEfiSioProtocolGuid,
174 This->DriverBindingHandle,
208 Status =
gBS->OpenProtocol (
210 &gEfiDevicePathProtocolGuid,
211 (VOID **)&DevicePath,
212 This->DriverBindingHandle,
214 EFI_OPEN_PROTOCOL_GET_PROTOCOL
216 if (EFI_ERROR (Status)) {
225 EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE,
232 Status =
gBS->OpenProtocol (
234 &gEfiSioProtocolGuid,
236 This->DriverBindingHandle,
238 EFI_OPEN_PROTOCOL_BY_DRIVER
240 if (EFI_ERROR (Status)) {
248 if (ConsoleIn ==
NULL) {
249 Status = EFI_OUT_OF_RESOURCES;
250 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
257 ConsoleIn->Signature = KEYBOARD_CONSOLE_IN_DEV_SIGNATURE;
258 ConsoleIn->Handle = Controller;
261 ConsoleIn->DataRegisterAddress = KEYBOARD_8042_DATA_REGISTER;
262 ConsoleIn->StatusRegisterAddress = KEYBOARD_8042_STATUS_REGISTER;
263 ConsoleIn->CommandRegisterAddress = KEYBOARD_8042_COMMAND_REGISTER;
264 ConsoleIn->DevicePath = DevicePath;
291 Status = EFI_DEVICE_ERROR;
292 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
300 Status =
gBS->CreateEvent (
305 &((ConsoleIn->ConIn).WaitForKey)
307 if (EFI_ERROR (Status)) {
308 Status = EFI_OUT_OF_RESOURCES;
309 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
316 Status =
gBS->CreateEvent (
323 if (EFI_ERROR (Status)) {
324 Status = EFI_OUT_OF_RESOURCES;
325 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
331 Status =
gBS->CreateEvent (
332 EVT_TIMER | EVT_NOTIFY_SIGNAL,
336 &ConsoleIn->TimerEvent
338 if (EFI_ERROR (Status)) {
339 Status = EFI_OUT_OF_RESOURCES;
340 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
344 Status =
gBS->SetTimer (
345 ConsoleIn->TimerEvent,
347 KEYBOARD_TIMER_INTERVAL
349 if (EFI_ERROR (Status)) {
350 Status = EFI_OUT_OF_RESOURCES;
351 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
355 Status =
gBS->CreateEvent (
360 &ConsoleIn->KeyNotifyProcessEvent
362 if (EFI_ERROR (Status)) {
363 Status = EFI_OUT_OF_RESOURCES;
364 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
370 EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT,
377 Status = ConsoleIn->ConInEx.Reset (&ConsoleIn->ConInEx,
FeaturePcdGet (PcdPs2KbdExtendedVerification));
378 if (EFI_ERROR (Status)) {
379 Status = EFI_DEVICE_ERROR;
380 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
386 EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DETECTED,
390 ConsoleIn->ControllerNameTable =
NULL;
394 &ConsoleIn->ControllerNameTable,
395 L
"PS/2 Keyboard Device",
401 &ConsoleIn->ControllerNameTable,
402 L
"PS/2 Keyboard Device",
409 Status =
gBS->InstallMultipleProtocolInterfaces (
411 &gEfiSimpleTextInProtocolGuid,
413 &gEfiSimpleTextInputExProtocolGuid,
417 if (EFI_ERROR (Status)) {
418 StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;
428 if (StatusCode != 0) {
440 if ((ConsoleIn !=
NULL) && (ConsoleIn->TimerEvent !=
NULL)) {
441 gBS->CloseEvent (ConsoleIn->TimerEvent);
448 if ((ConsoleIn !=
NULL) && (ConsoleIn->KeyNotifyProcessEvent !=
NULL)) {
449 gBS->CloseEvent (ConsoleIn->KeyNotifyProcessEvent);
453 if ((ConsoleIn !=
NULL) && (ConsoleIn->ControllerNameTable !=
NULL)) {
461 if (ConsoleIn !=
NULL) {
463 while (!EFI_ERROR (Status1) && (Status != EFI_DEVICE_ERROR)) {
468 if (ConsoleIn !=
NULL) {
469 gBS->FreePool (ConsoleIn);
474 &gEfiSioProtocolGuid,
475 This->DriverBindingHandle,
513 Status =
gBS->OpenProtocol (
515 &gEfiSimpleTextInProtocolGuid,
517 This->DriverBindingHandle,
519 EFI_OPEN_PROTOCOL_GET_PROTOCOL
521 if (EFI_ERROR (Status)) {
525 Status =
gBS->OpenProtocol (
527 &gEfiSimpleTextInputExProtocolGuid,
529 This->DriverBindingHandle,
531 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
533 if (EFI_ERROR (Status)) {
537 ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn);
544 EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE,
545 ConsoleIn->DevicePath
548 if (ConsoleIn->TimerEvent !=
NULL) {
549 gBS->CloseEvent (ConsoleIn->TimerEvent);
550 ConsoleIn->TimerEvent =
NULL;
558 while (!EFI_ERROR (Status)) {
565 Status =
gBS->UninstallMultipleProtocolInterfaces (
567 &gEfiSimpleTextInProtocolGuid,
569 &gEfiSimpleTextInputExProtocolGuid,
573 if (EFI_ERROR (Status)) {
579 &gEfiSioProtocolGuid,
580 This->DriverBindingHandle,
587 if ((ConsoleIn->ConIn).WaitForKey !=
NULL) {
588 gBS->CloseEvent ((ConsoleIn->ConIn).WaitForKey);
589 (ConsoleIn->ConIn).WaitForKey =
NULL;
597 if (ConsoleIn->KeyNotifyProcessEvent !=
NULL) {
598 gBS->CloseEvent (ConsoleIn->KeyNotifyProcessEvent);
599 ConsoleIn->KeyNotifyProcessEvent =
NULL;
604 gBS->FreePool (ConsoleIn);
624 if (ListHead ==
NULL) {
625 return EFI_INVALID_PARAMETER;
630 ListHead->ForwardLink,
633 KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE
636 gBS->FreePool (NotifyNode);
667 &gKeyboardControllerDriver,
669 &gPs2KeyboardComponentName,
670 &gPs2KeyboardComponentName2
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define ASSERT_EFI_ERROR(StatusParameter)
#define CR(Record, TYPE, Field, TestSignature)
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define PcdGetBool(TokenName)
#define FeaturePcdGet(TokenName)
UINT32 EFI_STATUS_CODE_VALUE
#define EFI_PROGRESS_CODE
UINT8 KeyReadStatusRegister(IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
VOID EFIAPI KeyboardTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS KeyboardRead(IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, OUT UINT8 *Data)
EFI_STATUS EFIAPI KeyboardReadKeyStrokeEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
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 EFIAPI KeyboardWaitForKeyEx(IN EFI_EVENT Event, IN VOID *Context)
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)
VOID EFIAPI KeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI InitializePs2Keyboard(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI KbdControllerDriverSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS KbdFreeNotifyList(IN OUT LIST_ENTRY *ListHead)
EFI_STATUS EFIAPI KbdControllerDriverStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI KbdControllerDriverStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI AddUnicodeString2(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
VOID EFIAPI KeyNotifyProcessHandler(IN EFI_EVENT Event, IN VOID *Context)
CHAR8 * SupportedLanguages
CHAR8 * SupportedLanguages