55 Status =
gBS->OpenProtocol (
57 &gEfiDevicePathProtocolGuid,
59 This->DriverBindingHandle,
61 EFI_OPEN_PROTOCOL_GET_PROTOCOL
63 if (EFI_ERROR (Status)) {
75 return EFI_UNSUPPORTED;
79 case EISA_PNP_ID (0xF03):
83 case EISA_PNP_ID (0xF13):
89 case EISA_PNP_ID (0x303):
98 return EFI_UNSUPPORTED;
105 Status =
gBS->OpenProtocol (
107 &gEfiSioProtocolGuid,
109 This->DriverBindingHandle,
111 EFI_OPEN_PROTOCOL_BY_DRIVER
113 if (EFI_ERROR (Status)) {
122 &gEfiSioProtocolGuid,
123 This->DriverBindingHandle,
166 Status =
gBS->OpenProtocol (
168 &gEfiDevicePathProtocolGuid,
169 (VOID **)&DevicePath,
170 This->DriverBindingHandle,
172 EFI_OPEN_PROTOCOL_GET_PROTOCOL
174 if (EFI_ERROR (Status)) {
183 EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE,
190 Status =
gBS->OpenProtocol (
192 &gEfiSioProtocolGuid,
194 This->DriverBindingHandle,
196 EFI_OPEN_PROTOCOL_BY_DRIVER
198 if (EFI_ERROR (Status)) {
205 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
211 if (MouseDev ==
NULL) {
212 Status = EFI_OUT_OF_RESOURCES;
219 MouseDev->Signature = PS2_MOUSE_DEV_SIGNATURE;
220 MouseDev->Handle = Controller;
221 MouseDev->SampleRate = SampleRate20;
222 MouseDev->Resolution = MouseResolution4;
223 MouseDev->Scaling = Scaling1;
224 MouseDev->DataPackageSize = 3;
225 MouseDev->DevicePath = DevicePath;
235 MouseDev->SimplePointerProtocol.Reset =
MouseReset;
237 MouseDev->SimplePointerProtocol.
Mode = &(MouseDev->Mode);
248 Data =
IoRead8 (KBC_CMD_STS_PORT);
252 if ((Data & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {
257 Status = EFI_DEVICE_ERROR;
258 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
264 if (EFI_ERROR (Status)) {
265 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR;
274 EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT,
281 Status = MouseDev->SimplePointerProtocol.Reset (
282 &MouseDev->SimplePointerProtocol,
285 if (EFI_ERROR (Status)) {
290 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
296 EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED,
303 Status =
gBS->CreateEvent (
308 &((MouseDev->SimplePointerProtocol).WaitForInput)
310 if (EFI_ERROR (Status)) {
311 Status = EFI_OUT_OF_RESOURCES;
318 Status =
gBS->CreateEvent (
319 EVT_TIMER | EVT_NOTIFY_SIGNAL,
323 &MouseDev->TimerEvent
325 if (EFI_ERROR (Status)) {
326 Status = EFI_OUT_OF_RESOURCES;
334 if (EFI_ERROR (Status)) {
335 Status = EFI_OUT_OF_RESOURCES;
339 MouseDev->ControllerNameTable =
NULL;
343 &MouseDev->ControllerNameTable,
344 L
"PS/2 Mouse Device",
350 &MouseDev->ControllerNameTable,
351 L
"PS/2 Mouse Device",
358 Status =
gBS->InstallMultipleProtocolInterfaces (
360 &gEfiSimplePointerProtocolGuid,
361 &MouseDev->SimplePointerProtocol,
364 if (EFI_ERROR (Status)) {
368 gBS->RestoreTPL (OldTpl);
374 if (Status != EFI_DEVICE_ERROR) {
378 if (StatusCode != 0) {
390 if ((MouseDev !=
NULL) && (MouseDev->TimerEvent !=
NULL)) {
391 gBS->CloseEvent (MouseDev->TimerEvent);
394 if ((MouseDev !=
NULL) && (MouseDev->ControllerNameTable !=
NULL)) {
398 if (Status != EFI_DEVICE_ERROR) {
404 while (!EFI_ERROR (EmptyStatus)) {
409 if (MouseDev !=
NULL) {
415 &gEfiDevicePathProtocolGuid,
416 This->DriverBindingHandle,
422 &gEfiSioProtocolGuid,
423 This->DriverBindingHandle,
427 gBS->RestoreTPL (OldTpl);
460 Status =
gBS->OpenProtocol (
462 &gEfiSimplePointerProtocolGuid,
463 (VOID **)&SimplePointerProtocol,
464 This->DriverBindingHandle,
466 EFI_OPEN_PROTOCOL_GET_PROTOCOL
468 if (EFI_ERROR (Status)) {
472 MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);
479 EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE,
483 Status =
gBS->UninstallProtocolInterface (
485 &gEfiSimplePointerProtocolGuid,
486 &MouseDev->SimplePointerProtocol
488 if (EFI_ERROR (Status)) {
496 gBS->CloseEvent (MouseDev->TimerEvent);
503 while (!EFI_ERROR (Status)) {
513 &gEfiDevicePathProtocolGuid,
514 This->DriverBindingHandle,
520 &gEfiSioProtocolGuid,
521 This->DriverBindingHandle,
544 IN BOOLEAN ExtendedVerification
550 BOOLEAN KeyboardEnable;
553 MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
560 EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET,
564 KeyboardEnable =
FALSE;
569 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
572 MouseDev->StateChanged =
FALSE;
578 while (!EFI_ERROR (Status)) {
604 if (EFI_ERROR (Status)) {
605 Status = EFI_DEVICE_ERROR;
610 if (EFI_ERROR (Status)) {
611 Status = EFI_DEVICE_ERROR;
616 if (EFI_ERROR (Status)) {
617 Status = EFI_DEVICE_ERROR;
622 if (EFI_ERROR (Status)) {
623 Status = EFI_DEVICE_ERROR;
628 if (EFI_ERROR (Status)) {
629 Status = EFI_DEVICE_ERROR;
635 gBS->RestoreTPL (OldTpl);
637 if (KeyboardEnable) {
662 if (!EFI_ERROR (Status)) {
689 MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
692 return EFI_INVALID_PARAMETER;
695 if (!MouseDev->StateChanged) {
696 return EFI_NOT_READY;
699 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
708 MouseDev->StateChanged =
FALSE;
709 gBS->RestoreTPL (OldTpl);
738 if (MouseDev->StateChanged) {
739 gBS->SignalEvent (Event);
796 &gPs2MouseComponentName,
797 &gPs2MouseComponentName2
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS PS2MouseReset(VOID)
EFI_STATUS CheckKbStatus(OUT BOOLEAN *KeyboardEnable)
EFI_STATUS PS2MouseSetResolution(IN MOUSE_RE Resolution)
EFI_STATUS In8042Data(IN OUT UINT8 *Data)
EFI_STATUS KbcEnableAux(VOID)
EFI_STATUS PS2MouseSetSampleRate(IN MOUSE_SR SampleRate)
EFI_STATUS PS2MouseSetScaling(IN MOUSE_SF Scaling)
EFI_STATUS PS2MouseEnable(VOID)
EFI_STATUS PS2MouseGetPacket(PS2_MOUSE_DEV *MouseDev)
EFI_STATUS KbcDisableAux(VOID)
EFI_STATUS KbcSelfTest(VOID)
EFI_STATUS KbcDisableKb(VOID)
EFI_STATUS KbcEnableKb(VOID)
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)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINT8 EFIAPI IoRead8(IN UINTN Port)
#define ASSERT_EFI_ERROR(StatusParameter)
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define FeaturePcdGet(TokenName)
UINT32 EFI_STATUS_CODE_VALUE
#define EFI_PROGRESS_CODE
#define EFI_P_MOUSE_PC_SELF_TEST
EFI_STATUS EFIAPI MouseGetState(IN EFI_SIMPLE_POINTER_PROTOCOL *This, IN OUT EFI_SIMPLE_POINTER_STATE *State)
EFI_STATUS EFIAPI PS2MouseDriverStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI PS2MouseDriverSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI InitializePs2Mouse(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver
EFI_STATUS EFIAPI MouseReset(IN EFI_SIMPLE_POINTER_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI PS2MouseDriverStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
VOID EFIAPI MouseWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
BOOLEAN CheckMouseConnect(IN PS2_MOUSE_DEV *MouseDev)
VOID EFIAPI PollMouse(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI Exit(IN EFI_STATUS Status)
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)
CHAR8 * SupportedLanguages
CHAR8 * SupportedLanguages
EFI_SIMPLE_POINTER_MODE * Mode