]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c
f8cfc4396635ef8fa75ba90e16f2d2ae19264043
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2MouseDxe / Ps2Mouse.c
1 /** @file
2 PS/2 Mouse driver. Routines that interacts with callers,
3 conforming to EFI driver model.
4
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include "Ps2Mouse.h"
11 #include "CommPs2.h"
12
13 ///
14 /// DriverBinding Protocol Instance
15 ///
16 EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver = {
17 PS2MouseDriverSupported,
18 PS2MouseDriverStart,
19 PS2MouseDriverStop,
20 0xa,
21 NULL,
22 NULL
23 };
24
25 /**
26 Test to see if this driver supports ControllerHandle. Any ControllerHandle
27 than contains a IsaIo protocol can be supported.
28
29 @param This Protocol instance pointer.
30 @param ControllerHandle Handle of device to test
31 @param RemainingDevicePath Optional parameter use to pick a specific child
32 device to start.
33
34 @retval EFI_SUCCESS This driver supports this device
35 @retval EFI_ALREADY_STARTED This driver is already running on this device
36 @retval other This driver does not support this device
37
38 **/
39 EFI_STATUS
40 EFIAPI
41 PS2MouseDriverSupported (
42 IN EFI_DRIVER_BINDING_PROTOCOL *This,
43 IN EFI_HANDLE Controller,
44 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
45 )
46 {
47 EFI_STATUS Status;
48 EFI_ISA_IO_PROTOCOL *IsaIo;
49
50 Status = EFI_SUCCESS;
51
52 //
53 // Open the IO Abstraction(s) needed to perform the supported test
54 //
55 Status = gBS->OpenProtocol (
56 Controller,
57 &gEfiIsaIoProtocolGuid,
58 (VOID **) &IsaIo,
59 This->DriverBindingHandle,
60 Controller,
61 EFI_OPEN_PROTOCOL_BY_DRIVER
62 );
63 if (EFI_ERROR (Status)) {
64 return Status;
65 }
66 //
67 // Use the ISA I/O Protocol to see if Controller is the Keyboard controller
68 //
69 switch (IsaIo->ResourceList->Device.HID) {
70 case EISA_PNP_ID (0xF03):
71 //
72 // Microsoft PS/2 style mouse
73 //
74 case EISA_PNP_ID (0xF13):
75 //
76 // PS/2 Port for PS/2-style Mice
77 //
78 break;
79
80 case EISA_PNP_ID (0x303):
81 //
82 // IBM Enhanced (101/102-key, PS/2 mouse support)
83 //
84 if (IsaIo->ResourceList->Device.UID == 1) {
85 break;
86 }
87
88 default:
89 Status = EFI_UNSUPPORTED;
90 break;
91 }
92 //
93 // Close the I/O Abstraction(s) used to perform the supported test
94 //
95 gBS->CloseProtocol (
96 Controller,
97 &gEfiIsaIoProtocolGuid,
98 This->DriverBindingHandle,
99 Controller
100 );
101
102 return Status;
103 }
104
105 /**
106 Start this driver on ControllerHandle by opening a IsaIo protocol, creating
107 PS2_MOUSE_ABSOLUTE_POINTER_DEV device and install gEfiAbsolutePointerProtocolGuid
108 finally.
109
110 @param This Protocol instance pointer.
111 @param ControllerHandle Handle of device to bind driver to
112 @param RemainingDevicePath Optional parameter use to pick a specific child
113 device to start.
114
115 @retval EFI_SUCCESS This driver is added to ControllerHandle
116 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
117 @retval other This driver does not support this device
118
119 **/
120 EFI_STATUS
121 EFIAPI
122 PS2MouseDriverStart (
123 IN EFI_DRIVER_BINDING_PROTOCOL *This,
124 IN EFI_HANDLE Controller,
125 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
126 )
127 {
128 EFI_STATUS Status;
129 EFI_STATUS EmptyStatus;
130 EFI_ISA_IO_PROTOCOL *IsaIo;
131 PS2_MOUSE_DEV *MouseDev;
132 UINT8 Data;
133 EFI_TPL OldTpl;
134 EFI_STATUS_CODE_VALUE StatusCode;
135 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
136
137 StatusCode = 0;
138 MouseDev = NULL;
139 IsaIo = NULL;
140
141 //
142 // Open the device path protocol
143 //
144 Status = gBS->OpenProtocol (
145 Controller,
146 &gEfiDevicePathProtocolGuid,
147 (VOID **) &ParentDevicePath,
148 This->DriverBindingHandle,
149 Controller,
150 EFI_OPEN_PROTOCOL_BY_DRIVER
151 );
152 if (EFI_ERROR (Status)) {
153 return Status;
154 }
155 //
156 // Report that the keyboard is being enabled
157 //
158 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
159 EFI_PROGRESS_CODE,
160 EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE,
161 ParentDevicePath
162 );
163
164 //
165 // Get the ISA I/O Protocol on Controller's handle
166 //
167 Status = gBS->OpenProtocol (
168 Controller,
169 &gEfiIsaIoProtocolGuid,
170 (VOID **) &IsaIo,
171 This->DriverBindingHandle,
172 Controller,
173 EFI_OPEN_PROTOCOL_BY_DRIVER
174 );
175 if (EFI_ERROR (Status)) {
176 gBS->CloseProtocol (
177 Controller,
178 &gEfiDevicePathProtocolGuid,
179 This->DriverBindingHandle,
180 Controller
181 );
182 return EFI_INVALID_PARAMETER;
183 }
184 //
185 // Raise TPL to avoid keyboard operation impact
186 //
187 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
188
189 //
190 // Allocate private data
191 //
192 MouseDev = AllocateZeroPool (sizeof (PS2_MOUSE_DEV));
193 if (MouseDev == NULL) {
194 Status = EFI_OUT_OF_RESOURCES;
195 goto ErrorExit;
196 }
197 //
198 // Setup the device instance
199 //
200 MouseDev->Signature = PS2_MOUSE_DEV_SIGNATURE;
201 MouseDev->Handle = Controller;
202 MouseDev->SampleRate = SampleRate20;
203 MouseDev->Resolution = MouseResolution4;
204 MouseDev->Scaling = Scaling1;
205 MouseDev->DataPackageSize = 3;
206 MouseDev->IsaIo = IsaIo;
207 MouseDev->DevicePath = ParentDevicePath;
208
209 //
210 // Resolution = 4 counts/mm
211 //
212 MouseDev->Mode.ResolutionX = 4;
213 MouseDev->Mode.ResolutionY = 4;
214 MouseDev->Mode.LeftButton = TRUE;
215 MouseDev->Mode.RightButton = TRUE;
216
217 MouseDev->SimplePointerProtocol.Reset = MouseReset;
218 MouseDev->SimplePointerProtocol.GetState = MouseGetState;
219 MouseDev->SimplePointerProtocol.Mode = &(MouseDev->Mode);
220
221 //
222 // Initialize keyboard controller if necessary
223 //
224 IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
225 //
226 // Fix for random hangs in System waiting for the Key if no KBC is present in BIOS.
227 //
228 if ((Data & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {
229 //
230 // If nobody decodes KBC I/O port, it will read back as 0xFF.
231 // Check the Time-Out and Parity bit to see if it has an active KBC in system
232 //
233 Status = EFI_DEVICE_ERROR;
234 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
235 goto ErrorExit;
236 }
237
238 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
239 EFI_PROGRESS_CODE,
240 EFI_PERIPHERAL_MOUSE | EFI_P_MOUSE_PC_SELF_TEST,
241 ParentDevicePath
242 );
243
244 if ((Data & KBC_SYSF) != KBC_SYSF) {
245 Status = KbcSelfTest (IsaIo);
246 if (EFI_ERROR (Status)) {
247 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR;
248 goto ErrorExit;
249 }
250 }
251
252 KbcEnableAux (IsaIo);
253
254 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
255 EFI_PROGRESS_CODE,
256 EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT,
257 ParentDevicePath
258 );
259
260 //
261 // Reset the mouse
262 //
263 Status = MouseDev->SimplePointerProtocol.Reset (
264 &MouseDev->SimplePointerProtocol,
265 FeaturePcdGet (PcdPs2MouseExtendedVerification)
266 );
267 if (EFI_ERROR (Status)) {
268 //
269 // mouse not connected
270 //
271 Status = EFI_SUCCESS;
272 StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
273 goto ErrorExit;
274 }
275
276 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
277 EFI_PROGRESS_CODE,
278 EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED,
279 ParentDevicePath
280 );
281
282 //
283 // Setup the WaitForKey event
284 //
285 Status = gBS->CreateEvent (
286 EVT_NOTIFY_WAIT,
287 TPL_NOTIFY,
288 MouseWaitForInput,
289 MouseDev,
290 &((MouseDev->SimplePointerProtocol).WaitForInput)
291 );
292 if (EFI_ERROR (Status)) {
293 Status = EFI_OUT_OF_RESOURCES;
294 goto ErrorExit;
295 }
296 //
297 // Setup a periodic timer, used to poll mouse state
298 //
299 Status = gBS->CreateEvent (
300 EVT_TIMER | EVT_NOTIFY_SIGNAL,
301 TPL_NOTIFY,
302 PollMouse,
303 MouseDev,
304 &MouseDev->TimerEvent
305 );
306 if (EFI_ERROR (Status)) {
307 Status = EFI_OUT_OF_RESOURCES;
308 goto ErrorExit;
309 }
310 //
311 // Start timer to poll mouse (100 samples per second)
312 //
313 Status = gBS->SetTimer (MouseDev->TimerEvent, TimerPeriodic, 100000);
314 if (EFI_ERROR (Status)) {
315 Status = EFI_OUT_OF_RESOURCES;
316 goto ErrorExit;
317 }
318
319 MouseDev->ControllerNameTable = NULL;
320 AddUnicodeString2 (
321 "eng",
322 gPs2MouseComponentName.SupportedLanguages,
323 &MouseDev->ControllerNameTable,
324 L"PS/2 Mouse Device",
325 TRUE
326 );
327 AddUnicodeString2 (
328 "en",
329 gPs2MouseComponentName2.SupportedLanguages,
330 &MouseDev->ControllerNameTable,
331 L"PS/2 Mouse Device",
332 FALSE
333 );
334
335
336 //
337 // Install protocol interfaces for the mouse device.
338 //
339 Status = gBS->InstallMultipleProtocolInterfaces (
340 &Controller,
341 &gEfiSimplePointerProtocolGuid,
342 &MouseDev->SimplePointerProtocol,
343 NULL
344 );
345 if (EFI_ERROR (Status)) {
346 goto ErrorExit;
347 }
348
349 gBS->RestoreTPL (OldTpl);
350
351 return Status;
352
353 ErrorExit:
354
355 if (Status != EFI_DEVICE_ERROR) {
356 KbcDisableAux (IsaIo);
357 }
358
359 if (StatusCode != 0) {
360 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
361 EFI_ERROR_CODE | EFI_ERROR_MINOR,
362 StatusCode,
363 ParentDevicePath
364 );
365 }
366
367 if ((MouseDev != NULL) && (MouseDev->SimplePointerProtocol.WaitForInput != NULL)) {
368 gBS->CloseEvent (MouseDev->SimplePointerProtocol.WaitForInput);
369 }
370
371 if ((MouseDev != NULL) && (MouseDev->TimerEvent != NULL)) {
372 gBS->CloseEvent (MouseDev->TimerEvent);
373 }
374
375 if ((MouseDev != NULL) && (MouseDev->ControllerNameTable != NULL)) {
376 FreeUnicodeStringTable (MouseDev->ControllerNameTable);
377 }
378
379 if (Status != EFI_DEVICE_ERROR) {
380 //
381 // Since there will be no timer handler for mouse input any more,
382 // exhaust input data just in case there is still mouse data left
383 //
384 EmptyStatus = EFI_SUCCESS;
385 while (!EFI_ERROR (EmptyStatus)) {
386 EmptyStatus = In8042Data (IsaIo, &Data);
387 }
388 }
389
390 if (MouseDev != NULL) {
391 FreePool (MouseDev);
392 }
393
394 gBS->CloseProtocol (
395 Controller,
396 &gEfiDevicePathProtocolGuid,
397 This->DriverBindingHandle,
398 Controller
399 );
400
401 gBS->CloseProtocol (
402 Controller,
403 &gEfiIsaIoProtocolGuid,
404 This->DriverBindingHandle,
405 Controller
406 );
407
408 gBS->RestoreTPL (OldTpl);
409
410 return Status;
411 }
412
413 /**
414 Stop this driver on ControllerHandle. Support stopping any child handles
415 created by this driver.
416
417 @param This Protocol instance pointer.
418 @param ControllerHandle Handle of device to stop driver on
419 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
420 children is zero stop the entire bus driver.
421 @param ChildHandleBuffer List of Child Handles to Stop.
422
423 @retval EFI_SUCCESS This driver is removed ControllerHandle
424 @retval other This driver was not removed from this device
425
426 **/
427 EFI_STATUS
428 EFIAPI
429 PS2MouseDriverStop (
430 IN EFI_DRIVER_BINDING_PROTOCOL *This,
431 IN EFI_HANDLE Controller,
432 IN UINTN NumberOfChildren,
433 IN EFI_HANDLE *ChildHandleBuffer
434 )
435 {
436 EFI_STATUS Status;
437 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
438 PS2_MOUSE_DEV *MouseDev;
439 UINT8 Data;
440
441 Status = gBS->OpenProtocol (
442 Controller,
443 &gEfiSimplePointerProtocolGuid,
444 (VOID **) &SimplePointerProtocol,
445 This->DriverBindingHandle,
446 Controller,
447 EFI_OPEN_PROTOCOL_GET_PROTOCOL
448 );
449 if (EFI_ERROR (Status)) {
450 return EFI_SUCCESS;
451 }
452
453 MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);
454
455 //
456 // Report that the keyboard is being disabled
457 //
458 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
459 EFI_PROGRESS_CODE,
460 EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE,
461 MouseDev->DevicePath
462 );
463
464 Status = gBS->UninstallProtocolInterface (
465 Controller,
466 &gEfiSimplePointerProtocolGuid,
467 &MouseDev->SimplePointerProtocol
468 );
469 if (EFI_ERROR (Status)) {
470 return Status;
471 }
472
473 //
474 // Cancel mouse data polling timer, close timer event
475 //
476 gBS->SetTimer (MouseDev->TimerEvent, TimerCancel, 0);
477 gBS->CloseEvent (MouseDev->TimerEvent);
478
479 //
480 // Since there will be no timer handler for mouse input any more,
481 // exhaust input data just in case there is still mouse data left
482 //
483 Status = EFI_SUCCESS;
484 while (!EFI_ERROR (Status)) {
485 Status = In8042Data (MouseDev->IsaIo, &Data);
486 }
487
488 gBS->CloseEvent (MouseDev->SimplePointerProtocol.WaitForInput);
489 FreeUnicodeStringTable (MouseDev->ControllerNameTable);
490 FreePool (MouseDev);
491
492 gBS->CloseProtocol (
493 Controller,
494 &gEfiDevicePathProtocolGuid,
495 This->DriverBindingHandle,
496 Controller
497 );
498
499 gBS->CloseProtocol (
500 Controller,
501 &gEfiIsaIoProtocolGuid,
502 This->DriverBindingHandle,
503 Controller
504 );
505
506 return EFI_SUCCESS;
507 }
508
509 /**
510 Reset the Mouse and do BAT test for it, if ExtendedVerification is TRUE and there is a mouse device connected to system
511
512 @param This - Pointer of simple pointer Protocol.
513 @param ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip.
514
515
516 @retval EFI_SUCCESS - The command byte is written successfully.
517 @retval EFI_DEVICE_ERROR - Errors occurred during resetting keyboard.
518
519 **/
520 EFI_STATUS
521 EFIAPI
522 MouseReset (
523 IN EFI_SIMPLE_POINTER_PROTOCOL *This,
524 IN BOOLEAN ExtendedVerification
525 )
526 {
527 EFI_STATUS Status;
528 PS2_MOUSE_DEV *MouseDev;
529 EFI_TPL OldTpl;
530 BOOLEAN KeyboardEnable;
531 UINT8 Data;
532
533 MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
534
535 //
536 // Report reset progress code
537 //
538 REPORT_STATUS_CODE_WITH_DEVICE_PATH (
539 EFI_PROGRESS_CODE,
540 EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET,
541 MouseDev->DevicePath
542 );
543
544 KeyboardEnable = FALSE;
545
546 //
547 // Raise TPL to avoid keyboard operation impact
548 //
549 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
550
551 ZeroMem (&MouseDev->State, sizeof (EFI_SIMPLE_POINTER_STATE));
552 MouseDev->StateChanged = FALSE;
553
554 //
555 // Exhaust input data
556 //
557 Status = EFI_SUCCESS;
558 while (!EFI_ERROR (Status)) {
559 Status = In8042Data (MouseDev->IsaIo, &Data);
560 }
561
562 CheckKbStatus (MouseDev->IsaIo, &KeyboardEnable);
563
564 KbcDisableKb (MouseDev->IsaIo);
565
566 MouseDev->IsaIo->Io.Read (MouseDev->IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
567
568 //
569 // if there's data block on KBC data port, read it out
570 //
571 if ((Data & KBC_OUTB) == KBC_OUTB) {
572 MouseDev->IsaIo->Io.Read (MouseDev->IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Data);
573 }
574
575 Status = EFI_SUCCESS;
576 //
577 // The PS2 mouse driver reset behavior is always successfully return no matter wheater or not there is mouse connected to system.
578 // This behavior is needed by performance speed. The following mouse command only succeessfully finish when mouse device is
579 // connected to system, so if PS2 mouse device not connect to system or user not ask for, we skip the mouse configuration and enabling
580 //
581 if (ExtendedVerification && CheckMouseConnect (MouseDev)) {
582 //
583 // Send mouse reset command and set mouse default configure
584 //
585 Status = PS2MouseReset (MouseDev->IsaIo);
586 if (EFI_ERROR (Status)) {
587 Status = EFI_DEVICE_ERROR;
588 goto Exit;
589 }
590
591 Status = PS2MouseSetSampleRate (MouseDev->IsaIo, MouseDev->SampleRate);
592 if (EFI_ERROR (Status)) {
593 Status = EFI_DEVICE_ERROR;
594 goto Exit;
595 }
596
597 Status = PS2MouseSetResolution (MouseDev->IsaIo, MouseDev->Resolution);
598 if (EFI_ERROR (Status)) {
599 Status = EFI_DEVICE_ERROR;
600 goto Exit;
601 }
602
603 Status = PS2MouseSetScaling (MouseDev->IsaIo, MouseDev->Scaling);
604 if (EFI_ERROR (Status)) {
605 Status = EFI_DEVICE_ERROR;
606 goto Exit;
607 }
608
609 Status = PS2MouseEnable (MouseDev->IsaIo);
610 if (EFI_ERROR (Status)) {
611 Status = EFI_DEVICE_ERROR;
612 goto Exit;
613 }
614 }
615 Exit:
616 gBS->RestoreTPL (OldTpl);
617
618 if (KeyboardEnable) {
619 KbcEnableKb (MouseDev->IsaIo);
620 }
621
622 return Status;
623 }
624
625 /**
626 Check whether there is Ps/2 mouse device in system
627
628 @param MouseDev - Mouse Private Data Structure
629
630 @retval TRUE - Keyboard in System.
631 @retval FALSE - Keyboard not in System.
632
633 **/
634 BOOLEAN
635 CheckMouseConnect (
636 IN PS2_MOUSE_DEV *MouseDev
637 )
638
639 {
640 EFI_STATUS Status;
641
642 Status = PS2MouseEnable (MouseDev->IsaIo);
643 if (!EFI_ERROR (Status)) {
644 return TRUE;
645 }
646
647 return FALSE;
648 }
649
650 /**
651 Get and Clear mouse status.
652
653 @param This - Pointer of simple pointer Protocol.
654 @param State - Output buffer holding status.
655
656 @retval EFI_INVALID_PARAMETER Output buffer is invalid.
657 @retval EFI_NOT_READY Mouse is not changed status yet.
658 @retval EFI_SUCCESS Mouse status is changed and get successful.
659 **/
660 EFI_STATUS
661 EFIAPI
662 MouseGetState (
663 IN EFI_SIMPLE_POINTER_PROTOCOL *This,
664 IN OUT EFI_SIMPLE_POINTER_STATE *State
665 )
666 {
667 PS2_MOUSE_DEV *MouseDev;
668 EFI_TPL OldTpl;
669
670 MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
671
672 if (State == NULL) {
673 return EFI_INVALID_PARAMETER;
674 }
675
676 if (!MouseDev->StateChanged) {
677 return EFI_NOT_READY;
678 }
679
680 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
681 CopyMem (State, &(MouseDev->State), sizeof (EFI_SIMPLE_POINTER_STATE));
682
683 //
684 // clear mouse state
685 //
686 MouseDev->State.RelativeMovementX = 0;
687 MouseDev->State.RelativeMovementY = 0;
688 MouseDev->State.RelativeMovementZ = 0;
689 MouseDev->StateChanged = FALSE;
690 gBS->RestoreTPL (OldTpl);
691
692 return EFI_SUCCESS;
693 }
694
695 /**
696
697 Event notification function for SIMPLE_POINTER.WaitForInput event.
698 Signal the event if there is input from mouse.
699
700 @param Event event object
701 @param Context event context
702
703 **/
704 VOID
705 EFIAPI
706 MouseWaitForInput (
707 IN EFI_EVENT Event,
708 IN VOID *Context
709 )
710 {
711 PS2_MOUSE_DEV *MouseDev;
712
713 MouseDev = (PS2_MOUSE_DEV *) Context;
714
715 //
716 // Someone is waiting on the mouse event, if there's
717 // input from mouse, signal the event
718 //
719 if (MouseDev->StateChanged) {
720 gBS->SignalEvent (Event);
721 }
722
723 }
724
725 /**
726 Event notification function for TimerEvent event.
727 If mouse device is connected to system, try to get the mouse packet data.
728
729 @param Event - TimerEvent in PS2_MOUSE_DEV
730 @param Context - Pointer to PS2_MOUSE_DEV structure
731
732 **/
733 VOID
734 EFIAPI
735 PollMouse (
736 IN EFI_EVENT Event,
737 IN VOID *Context
738 )
739
740 {
741 PS2_MOUSE_DEV *MouseDev;
742
743 MouseDev = (PS2_MOUSE_DEV *) Context;
744
745 //
746 // Polling mouse packet data
747 //
748 PS2MouseGetPacket (MouseDev);
749 }
750
751 /**
752 The user Entry Point for module Ps2Mouse. The user code starts with this function.
753
754 @param[in] ImageHandle The firmware allocated handle for the EFI image.
755 @param[in] SystemTable A pointer to the EFI System Table.
756
757 @retval EFI_SUCCESS The entry point is executed successfully.
758 @retval other Some error occurs when executing this entry point.
759
760 **/
761 EFI_STATUS
762 EFIAPI
763 InitializePs2Mouse(
764 IN EFI_HANDLE ImageHandle,
765 IN EFI_SYSTEM_TABLE *SystemTable
766 )
767 {
768 EFI_STATUS Status;
769
770 //
771 // Install driver model protocol(s).
772 //
773 Status = EfiLibInstallDriverBindingComponentName2 (
774 ImageHandle,
775 SystemTable,
776 &gPS2MouseDriver,
777 ImageHandle,
778 &gPs2MouseComponentName,
779 &gPs2MouseComponentName2
780 );
781 ASSERT_EFI_ERROR (Status);
782
783
784 return Status;
785 }
786