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