\r
**/\r
\r
-#include "Ps2MouseSimulateTouchPad.h"\r
+#include "Ps2MouseAbsolutePointer.h"\r
#include "CommPs2.h"\r
\r
UINT8 SampleRateTbl[MAX_SR] = { 0xa, 0x14, 0x28, 0x3c, 0x50, 0x64, 0xc8 };\r
\r
EFI_STATUS\r
PS2MouseGetPacket (\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev\r
)\r
/*++\r
\r
//\r
// Read mouse first byte data, if failed, immediately return\r
//\r
- KbcDisableAux (MouseSimulateTouchPadDev->IsaIo);\r
- Status = PS2MouseRead (MouseSimulateTouchPadDev->IsaIo, &Data, &Count, State);\r
+ KbcDisableAux (MouseAbsolutePointerDev->IsaIo);\r
+ Status = PS2MouseRead (MouseAbsolutePointerDev->IsaIo, &Data, &Count, State);\r
if (EFI_ERROR (Status)) {\r
- KbcEnableAux (MouseSimulateTouchPadDev->IsaIo);\r
+ KbcEnableAux (MouseAbsolutePointerDev->IsaIo);\r
return EFI_NOT_READY;\r
}\r
\r
if (Count != 1) {\r
- KbcEnableAux (MouseSimulateTouchPadDev->IsaIo);\r
+ KbcEnableAux (MouseAbsolutePointerDev->IsaIo);\r
return EFI_NOT_READY;\r
}\r
\r
Packet[0] = Data;\r
State = PS2_READ_DATA_BYTE;\r
\r
- CheckKbStatus (MouseSimulateTouchPadDev->IsaIo, &KeyboardEnable);\r
- KbcDisableKb (MouseSimulateTouchPadDev->IsaIo);\r
- KbcEnableAux (MouseSimulateTouchPadDev->IsaIo);\r
+ CheckKbStatus (MouseAbsolutePointerDev->IsaIo, &KeyboardEnable);\r
+ KbcDisableKb (MouseAbsolutePointerDev->IsaIo);\r
+ KbcEnableAux (MouseAbsolutePointerDev->IsaIo);\r
}\r
break;\r
\r
case PS2_READ_DATA_BYTE:\r
Count = 2;\r
- Status = PS2MouseRead (MouseSimulateTouchPadDev->IsaIo, (Packet + 1), &Count, State);\r
+ Status = PS2MouseRead (MouseAbsolutePointerDev->IsaIo, (Packet + 1), &Count, State);\r
if (EFI_ERROR (Status)) {\r
if (KeyboardEnable) {\r
- KbcEnableKb (MouseSimulateTouchPadDev->IsaIo);\r
+ KbcEnableKb (MouseAbsolutePointerDev->IsaIo);\r
}\r
\r
return EFI_NOT_READY;\r
\r
if (Count != 2) {\r
if (KeyboardEnable) {\r
- KbcEnableKb (MouseSimulateTouchPadDev->IsaIo);\r
+ KbcEnableKb (MouseAbsolutePointerDev->IsaIo);\r
}\r
\r
return EFI_NOT_READY;\r
\r
case PS2_PROCESS_PACKET:\r
if (KeyboardEnable) {\r
- KbcEnableKb (MouseSimulateTouchPadDev->IsaIo);\r
+ KbcEnableKb (MouseAbsolutePointerDev->IsaIo);\r
}\r
//\r
// Decode the packet\r
//\r
// Update mouse state\r
//\r
- MouseSimulateTouchPadDev->State.CurrentX += RelativeMovementX;\r
- MouseSimulateTouchPadDev->State.CurrentY -= RelativeMovementY;\r
- MouseSimulateTouchPadDev->State.CurrentZ = 0;\r
- MouseSimulateTouchPadDev->State.ActiveButtons = (UINT8) (LButton || RButton) & 0x3;\r
- MouseSimulateTouchPadDev->StateChanged = TRUE;\r
+ MouseAbsolutePointerDev->State.CurrentX += RelativeMovementX;\r
+ MouseAbsolutePointerDev->State.CurrentY -= RelativeMovementY;\r
+ MouseAbsolutePointerDev->State.CurrentZ = 0;\r
+ MouseAbsolutePointerDev->State.ActiveButtons = (UINT8) (LButton || RButton) & 0x3;\r
+ MouseAbsolutePointerDev->StateChanged = TRUE;\r
\r
return EFI_SUCCESS;\r
}\r
\r
EFI_STATUS\r
PS2MouseGetPacket (\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev\r
)\r
/*++\r
\r
\r
**/\r
\r
-#include "Ps2MouseSimulateTouchPad.h"\r
+#include "Ps2MouseAbsolutePointer.h"\r
\r
//\r
// EFI Component Name Protocol\r
//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPs2MouseSimulateTouchPadComponentName = {\r
- Ps2MouseSimulateTouchPadComponentNameGetDriverName,\r
- Ps2MouseSimulateTouchPadComponentNameGetControllerName,\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPs2MouseAbsolutePointerComponentName = {\r
+ Ps2MouseAbsolutePointerComponentNameGetDriverName,\r
+ Ps2MouseAbsolutePointerComponentNameGetControllerName,\r
"eng"\r
};\r
\r
//\r
// EFI Component Name 2 Protocol\r
//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseSimulateTouchPadComponentName2 = {\r
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseSimulateTouchPadComponentNameGetDriverName,\r
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseSimulateTouchPadComponentNameGetControllerName,\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseAbsolutePointerComponentName2 = {\r
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseAbsolutePointerComponentNameGetDriverName,\r
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseAbsolutePointerComponentNameGetControllerName,\r
"en"\r
};\r
\r
\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseSimulateTouchPadDriverNameTable[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseAbsolutePointerDriverNameTable[] = {\r
{\r
"eng;en",\r
L"faked PS/2 Touchpad Driver"\r
**/\r
EFI_STATUS\r
EFIAPI\r
-Ps2MouseSimulateTouchPadComponentNameGetDriverName (\r
+Ps2MouseAbsolutePointerComponentNameGetDriverName (\r
IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
IN CHAR8 *Language,\r
OUT CHAR16 **DriverName\r
return LookupUnicodeString2 (\r
Language,\r
This->SupportedLanguages,\r
- mPs2MouseSimulateTouchPadDriverNameTable,\r
+ mPs2MouseAbsolutePointerDriverNameTable,\r
DriverName,\r
- (BOOLEAN)(This == &gPs2MouseSimulateTouchPadComponentName)\r
+ (BOOLEAN)(This == &gPs2MouseAbsolutePointerComponentName)\r
);\r
}\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
-Ps2MouseSimulateTouchPadComponentNameGetControllerName (\r
+Ps2MouseAbsolutePointerComponentNameGetControllerName (\r
IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
IN EFI_HANDLE ControllerHandle,\r
IN EFI_HANDLE ChildHandle OPTIONAL,\r
{\r
EFI_STATUS Status;\r
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
EFI_ISA_IO_PROTOCOL *IsaIoProtocol;\r
\r
//\r
ControllerHandle,\r
&gEfiIsaIoProtocolGuid,\r
(VOID **) &IsaIoProtocol,\r
- gPS2MouseSimulateTouchPadDriver.DriverBindingHandle,\r
+ gPS2MouseAbsolutePointerDriver.DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
);\r
gBS->CloseProtocol (\r
ControllerHandle,\r
&gEfiIsaIoProtocolGuid,\r
- gPS2MouseSimulateTouchPadDriver.DriverBindingHandle,\r
+ gPS2MouseAbsolutePointerDriver.DriverBindingHandle,\r
ControllerHandle\r
);\r
\r
ControllerHandle,\r
&gEfiAbsolutePointerProtocolGuid,\r
(VOID **) &AbsolutePointerProtocol,\r
- gPS2MouseSimulateTouchPadDriver.DriverBindingHandle,\r
+ gPS2MouseAbsolutePointerDriver.DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
);\r
return Status;\r
}\r
\r
- MouseSimulateTouchPadDev = PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_THIS (AbsolutePointerProtocol);\r
+ MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (AbsolutePointerProtocol);\r
\r
return LookupUnicodeString2 (\r
Language,\r
This->SupportedLanguages,\r
- MouseSimulateTouchPadDev->ControllerNameTable,\r
+ MouseAbsolutePointerDev->ControllerNameTable,\r
ControllerName,\r
- (BOOLEAN)(This == &gPs2MouseSimulateTouchPadComponentName)\r
+ (BOOLEAN)(This == &gPs2MouseAbsolutePointerComponentName)\r
);\r
}\r
--- /dev/null
+/**@file\r
+ A faked PS/2 Touchpad driver. Routines that interacts with callers,\r
+ conforming to EFI driver model\r
+ \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "Ps2MouseAbsolutePointer.h"\r
+#include "CommPs2.h"\r
+\r
+//\r
+// DriverBinding Protocol Instance\r
+//\r
+EFI_DRIVER_BINDING_PROTOCOL gPS2MouseAbsolutePointerDriver = {\r
+ PS2MouseAbsolutePointerDriverSupported,\r
+ PS2MouseAbsolutePointerDriverStart,\r
+ PS2MouseAbsolutePointerDriverStop,\r
+ 0x1,\r
+ NULL,\r
+ NULL\r
+};\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ ControllerDriver Protocol Method\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+// GC_TODO: This - add argument and description to function comment\r
+// GC_TODO: Controller - add argument and description to function comment\r
+// GC_TODO: RemainingDevicePath - add argument and description to function comment\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_ISA_IO_PROTOCOL *IsaIo;\r
+\r
+ Status = EFI_SUCCESS;\r
+\r
+ //\r
+ // Open the IO Abstraction(s) needed to perform the supported test\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiIsaIoProtocolGuid,\r
+ (VOID **) &IsaIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Use the ISA I/O Protocol to see if Controller is the Mouse controller\r
+ //\r
+ switch (IsaIo->ResourceList->Device.HID) {\r
+ case EISA_PNP_ID (0xF03):\r
+ //\r
+ // Microsoft PS/2 style mouse\r
+ //\r
+ case EISA_PNP_ID (0xF13):\r
+ //\r
+ // PS/2 Port for PS/2-style Mice\r
+ //\r
+ break;\r
+\r
+ case EISA_PNP_ID (0x303):\r
+ //\r
+ // IBM Enhanced (101/102-key, PS/2 mouse support)\r
+ //\r
+ if (IsaIo->ResourceList->Device.UID == 1) {\r
+ break;\r
+ }\r
+\r
+ default:\r
+ Status = EFI_UNSUPPORTED;\r
+ break;\r
+ }\r
+ //\r
+ // Close the I/O Abstraction(s) used to perform the supported test\r
+ //\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiIsaIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Start protocol interfaces for the mouse device handles.\r
+\r
+Arguments:\r
+ This - Protocol instance pointer.\r
+ Controller - Handle of device to bind driver to.\r
+ RemainingDevicePath - Not used.\r
+\r
+Returns:\r
+ EFI_SUCCESS - This driver is added to DeviceHandle.\r
+ other - Errors occurred.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_STATUS EmptyStatus;\r
+ EFI_ISA_IO_PROTOCOL *IsaIo;\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+ UINT8 Data;\r
+ EFI_TPL OldTpl;\r
+ EFI_STATUS_CODE_VALUE StatusCode;\r
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
+\r
+ StatusCode = 0;\r
+ MouseAbsolutePointerDev = NULL;\r
+ IsaIo = NULL;\r
+\r
+ //\r
+ // Open the device path protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &ParentDevicePath,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Report that the keyboard is being enabled\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE,\r
+ ParentDevicePath\r
+ );\r
+\r
+ //\r
+ // Get the ISA I/O Protocol on Controller's handle\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiIsaIoProtocolGuid,\r
+ (VOID **) &IsaIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // Raise TPL to avoid keyboard operation impact\r
+ //\r
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
+\r
+ //\r
+ // Allocate private data\r
+ //\r
+ MouseAbsolutePointerDev = AllocateZeroPool (sizeof (PS2_MOUSE_ABSOLUTE_POINTER_DEV));\r
+ if (MouseAbsolutePointerDev == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+ //\r
+ // Setup the device instance\r
+ //\r
+ MouseAbsolutePointerDev->Signature = PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE;\r
+ MouseAbsolutePointerDev->Handle = Controller;\r
+ MouseAbsolutePointerDev->SampleRate = SSR_20;\r
+ MouseAbsolutePointerDev->Resolution = CMR4;\r
+ MouseAbsolutePointerDev->Scaling = SF1;\r
+ MouseAbsolutePointerDev->DataPackageSize = 3;\r
+ MouseAbsolutePointerDev->IsaIo = IsaIo;\r
+ MouseAbsolutePointerDev->DevicePath = ParentDevicePath;\r
+\r
+ //\r
+ // Resolution = 4 counts/mm\r
+ //\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMaxX = 1024;\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMinX = 0;\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMaxY = 798;\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMinY = 0;\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMaxZ = 0;\r
+ MouseAbsolutePointerDev->Mode.AbsoluteMinZ = 0;\r
+ MouseAbsolutePointerDev->Mode.Attributes = 0x03;\r
+\r
+ MouseAbsolutePointerDev->AbsolutePointerProtocol.Reset = MouseAbsolutePointerReset;\r
+ MouseAbsolutePointerDev->AbsolutePointerProtocol.GetState = MouseAbsolutePointerGetState;\r
+ MouseAbsolutePointerDev->AbsolutePointerProtocol.Mode = &(MouseAbsolutePointerDev->Mode);\r
+\r
+ //\r
+ // Initialize keyboard controller if necessary\r
+ //\r
+ IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);\r
+ if ((Data & KBC_SYSF) != KBC_SYSF) {\r
+ Status = KbcSelfTest (IsaIo);\r
+ if (EFI_ERROR (Status)) {\r
+ StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ }\r
+\r
+ KbcEnableAux (IsaIo);\r
+\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT,\r
+ ParentDevicePath\r
+ );\r
+\r
+ //\r
+ // Reset the mouse\r
+ //\r
+ Status = MouseAbsolutePointerDev->AbsolutePointerProtocol.Reset (&MouseAbsolutePointerDev->AbsolutePointerProtocol, TRUE);\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // mouse not connected\r
+ //\r
+ Status = EFI_SUCCESS;\r
+ StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;\r
+ goto ErrorExit;\r
+ }\r
+ //\r
+ // Setup the WaitForKey event\r
+ //\r
+ Status = gBS->CreateEvent (\r
+ EVT_NOTIFY_WAIT,\r
+ TPL_NOTIFY,\r
+ MouseAbsolutePointerWaitForInput,\r
+ MouseAbsolutePointerDev,\r
+ &((MouseAbsolutePointerDev->AbsolutePointerProtocol).WaitForInput)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+ //\r
+ // Setup a periodic timer, used to poll mouse state\r
+ //\r
+ Status = gBS->CreateEvent (\r
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+ TPL_NOTIFY,\r
+ PollMouseAbsolutePointer,\r
+ MouseAbsolutePointerDev,\r
+ &MouseAbsolutePointerDev->TimerEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+ //\r
+ // Start timer to poll mouse (100 samples per second)\r
+ //\r
+ Status = gBS->SetTimer (MouseAbsolutePointerDev->TimerEvent, TimerPeriodic, 100000);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ MouseAbsolutePointerDev->ControllerNameTable = NULL;\r
+ AddUnicodeString2 (\r
+ "eng",\r
+ gPs2MouseAbsolutePointerComponentName.SupportedLanguages,\r
+ &MouseAbsolutePointerDev->ControllerNameTable,\r
+ L"Faked PS/2 Touchpad Device",\r
+ TRUE\r
+ );\r
+ AddUnicodeString2 (\r
+ "en",\r
+ gPs2MouseAbsolutePointerComponentName2.SupportedLanguages,\r
+ &MouseAbsolutePointerDev->ControllerNameTable,\r
+ L"Faked PS/2 Touchpad Device",\r
+ FALSE\r
+ );\r
+\r
+\r
+ //\r
+ // Install protocol interfaces for the mouse device.\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &Controller,\r
+ &gEfiAbsolutePointerProtocolGuid,\r
+ &MouseAbsolutePointerDev->AbsolutePointerProtocol,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ErrorExit;\r
+ }\r
+\r
+ gBS->RestoreTPL (OldTpl);\r
+\r
+ return Status;\r
+\r
+ErrorExit:\r
+\r
+ KbcDisableAux (IsaIo);\r
+\r
+ if (StatusCode != 0) {\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+ StatusCode,\r
+ ParentDevicePath\r
+ );\r
+ }\r
+\r
+ if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput != NULL)) {\r
+ gBS->CloseEvent (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput);\r
+ }\r
+\r
+ if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->TimerEvent != NULL)) {\r
+ gBS->CloseEvent (MouseAbsolutePointerDev->TimerEvent);\r
+ }\r
+\r
+ if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->ControllerNameTable != NULL)) {\r
+ FreeUnicodeStringTable (MouseAbsolutePointerDev->ControllerNameTable);\r
+ }\r
+ //\r
+ // Since there will be no timer handler for mouse input any more,\r
+ // exhaust input data just in case there is still mouse data left\r
+ //\r
+ EmptyStatus = EFI_SUCCESS;\r
+ while (!EFI_ERROR (EmptyStatus)) {\r
+ EmptyStatus = In8042Data (IsaIo, &Data);\r
+ }\r
+\r
+ if (MouseAbsolutePointerDev != NULL) {\r
+ gBS->FreePool (MouseAbsolutePointerDev);\r
+ }\r
+\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiIsaIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ gBS->RestoreTPL (OldTpl);\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE *ChildHandleBuffer\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+\r
+ Arguments:\r
+\r
+ Returns:\r
+\r
+--*/\r
+// GC_TODO: This - add argument and description to function comment\r
+// GC_TODO: Controller - add argument and description to function comment\r
+// GC_TODO: NumberOfChildren - add argument and description to function comment\r
+// GC_TODO: ChildHandleBuffer - add argument and description to function comment\r
+// GC_TODO: EFI_SUCCESS - add return value to function comment\r
+// GC_TODO: EFI_SUCCESS - add return value to function comment\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+ UINT8 Data;\r
+\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiAbsolutePointerProtocolGuid,\r
+ (VOID **) &AbsolutePointerProtocol,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (AbsolutePointerProtocol);\r
+\r
+ //\r
+ // Report that the keyboard is being disabled\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE,\r
+ MouseAbsolutePointerDev->DevicePath\r
+ );\r
+\r
+ Status = gBS->UninstallProtocolInterface (\r
+ Controller,\r
+ &gEfiAbsolutePointerProtocolGuid,\r
+ &MouseAbsolutePointerDev->AbsolutePointerProtocol\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Disable mouse on keyboard controller\r
+ //\r
+ KbcDisableAux (MouseAbsolutePointerDev->IsaIo);\r
+\r
+ //\r
+ // Cancel mouse data polling timer, close timer event\r
+ //\r
+ gBS->SetTimer (MouseAbsolutePointerDev->TimerEvent, TimerCancel, 0);\r
+ gBS->CloseEvent (MouseAbsolutePointerDev->TimerEvent);\r
+\r
+ //\r
+ // Since there will be no timer handler for mouse input any more,\r
+ // exhaust input data just in case there is still mouse data left\r
+ //\r
+ Status = EFI_SUCCESS;\r
+ while (!EFI_ERROR (Status)) {\r
+ Status = In8042Data (MouseAbsolutePointerDev->IsaIo, &Data);\r
+ }\r
+\r
+ gBS->CloseEvent (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput);\r
+ FreeUnicodeStringTable (MouseAbsolutePointerDev->ControllerNameTable);\r
+ gBS->FreePool (MouseAbsolutePointerDev);\r
+\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiIsaIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MouseAbsolutePointerReset (\r
+ IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system\r
+\r
+Arguments:\r
+\r
+ This - Pointer of simple pointer Protocol.\r
+ ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The command byte is written successfully.\r
+ EFI_DEVICE_ERROR - Errors occurred during reseting keyboard.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+ EFI_TPL OldTpl;\r
+ BOOLEAN KeyboardEnable;\r
+ UINT8 Data;\r
+\r
+ MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (This);\r
+\r
+ //\r
+ // Report reset progress code\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET,\r
+ MouseAbsolutePointerDev->DevicePath\r
+ );\r
+\r
+ KeyboardEnable = FALSE;\r
+\r
+ //\r
+ // Raise TPL to avoid keyboard operation impact\r
+ //\r
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
+\r
+ ZeroMem (&MouseAbsolutePointerDev->State, sizeof (EFI_ABSOLUTE_POINTER_STATE));\r
+ MouseAbsolutePointerDev->StateChanged = FALSE;\r
+\r
+ //\r
+ // Exhaust input data\r
+ //\r
+ Status = EFI_SUCCESS;\r
+ while (!EFI_ERROR (Status)) {\r
+ Status = In8042Data (MouseAbsolutePointerDev->IsaIo, &Data);\r
+ }\r
+\r
+ CheckKbStatus (MouseAbsolutePointerDev->IsaIo, &KeyboardEnable);\r
+\r
+ KbcDisableKb (MouseAbsolutePointerDev->IsaIo);\r
+\r
+ MouseAbsolutePointerDev->IsaIo->Io.Read (MouseAbsolutePointerDev->IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);\r
+\r
+ //\r
+ // if there's data block on KBC data port, read it out\r
+ //\r
+ if ((Data & KBC_OUTB) == KBC_OUTB) {\r
+ MouseAbsolutePointerDev->IsaIo->Io.Read (MouseAbsolutePointerDev->IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Data);\r
+ }\r
+\r
+ Status = EFI_SUCCESS;\r
+ //\r
+ // The PS2 mouse driver reset behavior is always successfully return no matter wheater or not there is mouse connected to system.\r
+ // This behavior is needed by performance speed. The following mouse command only succeessfully finish when mouse device is\r
+ // connected to system, so if PS2 mouse device not connect to system or user not ask for, we skip the mouse configuration and enabling\r
+ //\r
+ if (ExtendedVerification && CheckMouseAbsolutePointerConnect (MouseAbsolutePointerDev)) {\r
+ //\r
+ // Send mouse reset command and set mouse default configure\r
+ //\r
+ Status = PS2MouseReset (MouseAbsolutePointerDev->IsaIo);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Exit;\r
+ }\r
+\r
+ Status = PS2MouseSetSampleRate (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->SampleRate);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Exit;\r
+ }\r
+\r
+ Status = PS2MouseSetResolution (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->Resolution);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Exit;\r
+ }\r
+\r
+ Status = PS2MouseSetScaling (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->Scaling);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Exit;\r
+ }\r
+\r
+ Status = PS2MouseEnable (MouseAbsolutePointerDev->IsaIo);\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Exit;\r
+ }\r
+ }\r
+Exit:\r
+ gBS->RestoreTPL (OldTpl);\r
+\r
+ if (KeyboardEnable) {\r
+ KbcEnableKb (MouseAbsolutePointerDev->IsaIo);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+BOOLEAN\r
+CheckMouseAbsolutePointerConnect (\r
+ IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Check whether there is Ps/2 mouse device in system\r
+\r
+Arguments:\r
+\r
+ PS2_MOUSE_DEV - Mouse Private Data Structure\r
+\r
+Returns:\r
+\r
+ TRUE - Keyboard in System.\r
+ FALSE - Keyboard not in System.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = PS2MouseEnable (MouseAbsolutePointerDev->IsaIo);\r
+ if (!EFI_ERROR (Status)) {\r
+ return TRUE;\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MouseAbsolutePointerGetState (\r
+ IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+ IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ This - GC_TODO: add argument description\r
+ State - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - GC_TODO: Add description for return value\r
+ EFI_NOT_READY - GC_TODO: Add description for return value\r
+ EFI_SUCCESS - GC_TODO: Add description for return value\r
+\r
+--*/\r
+{\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+ EFI_TPL OldTpl;\r
+\r
+ MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (This);\r
+\r
+ if (State == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (!MouseAbsolutePointerDev->StateChanged) {\r
+ return EFI_NOT_READY;\r
+ }\r
+\r
+ OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
+ CopyMem (State, &(MouseAbsolutePointerDev->State), sizeof (EFI_ABSOLUTE_POINTER_STATE));\r
+\r
+ //\r
+ // clear mouse state\r
+ //\r
+ MouseAbsolutePointerDev->State.CurrentX = 0;\r
+ MouseAbsolutePointerDev->State.CurrentY = 0;\r
+ MouseAbsolutePointerDev->State.CurrentZ = 0;\r
+ MouseAbsolutePointerDev->State.ActiveButtons = 0x0;\r
+ MouseAbsolutePointerDev->StateChanged = FALSE;\r
+ gBS->RestoreTPL (OldTpl);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+MouseAbsolutePointerWaitForInput (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Event notification function for SIMPLE_POINTER.WaitForInput event\r
+ Signal the event if there is input from mouse\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+// GC_TODO: Event - add argument and description to function comment\r
+// GC_TODO: Context - add argument and description to function comment\r
+{\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+\r
+ MouseAbsolutePointerDev = (PS2_MOUSE_ABSOLUTE_POINTER_DEV *) Context;\r
+\r
+ //\r
+ // Someone is waiting on the mouse event, if there's\r
+ // input from mouse, signal the event\r
+ //\r
+ if (MouseAbsolutePointerDev->StateChanged) {\r
+ gBS->SignalEvent (Event);\r
+ }\r
+\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+PollMouseAbsolutePointer(\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Event notification function for TimerEvent event\r
+ If mouse device is connected to system, try to get the mouse packet data\r
+\r
+Arguments:\r
+\r
+ Event - TimerEvent in PS2_MOUSE_DEV\r
+ Context - Pointer to PS2_MOUSE_DEV structure\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r
+\r
+ MouseAbsolutePointerDev = (PS2_MOUSE_ABSOLUTE_POINTER_DEV *) Context;\r
+\r
+ //\r
+ // Polling mouse packet data\r
+ //\r
+ PS2MouseGetPacket (MouseAbsolutePointerDev);\r
+}\r
+\r
+/**\r
+ The user Entry Point for module Ps2MouseAbsolutePointer. The user code starts with this function.\r
+\r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
+ @param[in] SystemTable A pointer to the EFI System Table.\r
+ \r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval other Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializePs2MouseAbsolutePointer(\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Install driver model protocol(s).\r
+ //\r
+ Status = EfiLibInstallDriverBindingComponentName2 (\r
+ ImageHandle,\r
+ SystemTable,\r
+ &gPS2MouseAbsolutePointerDriver,\r
+ ImageHandle,\r
+ &gPs2MouseAbsolutePointerComponentName,\r
+ &gPs2MouseAbsolutePointerComponentName2\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+\r
+ return Status;\r
+}\r
--- /dev/null
+/**@file\r
+ A Ps2MouseAbsolutePointer driver header file\r
+ \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _PS2MOUSEABSOLUTEPOINTER_H\r
+#define _PS2MOUSEABSOLUTEPOINTER_H\r
+\r
+#include <PiDxe.h>\r
+#include <Framework/StatusCode.h>\r
+\r
+#include <Protocol/AbsolutePointer.h>\r
+#include <Protocol/IsaIo.h>\r
+#include <Protocol/DevicePath.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+\r
+//\r
+// PS/2 mouse sample rate\r
+//\r
+typedef enum {\r
+ SSR_10,\r
+ SSR_20,\r
+ SSR_40,\r
+ SSR_60,\r
+ SSR_80,\r
+ SSR_100,\r
+ SSR_200,\r
+ MAX_SR\r
+} MOUSE_SR;\r
+\r
+//\r
+// PS/2 mouse resolution\r
+//\r
+typedef enum {\r
+ CMR1,\r
+ CMR2,\r
+ CMR4,\r
+ CMR8,\r
+ MAX_CMR\r
+} MOUSE_RE;\r
+\r
+//\r
+// PS/2 mouse scaling\r
+//\r
+typedef enum {\r
+ SF1,\r
+ SF2\r
+} MOUSE_SF;\r
+\r
+//\r
+// Driver Private Data\r
+//\r
+#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE EFI_SIGNATURE_32 ('p', '2', 's', 't')\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+\r
+ EFI_HANDLE Handle;\r
+ EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol;\r
+ EFI_ABSOLUTE_POINTER_STATE State;\r
+ EFI_ABSOLUTE_POINTER_MODE Mode;\r
+ BOOLEAN StateChanged;\r
+\r
+ //\r
+ // PS2 Mouse device specific information\r
+ //\r
+ MOUSE_SR SampleRate;\r
+ MOUSE_RE Resolution;\r
+ MOUSE_SF Scaling;\r
+ UINT8 DataPackageSize;\r
+\r
+ EFI_ISA_IO_PROTOCOL *IsaIo;\r
+\r
+ EFI_EVENT TimerEvent;\r
+\r
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+} PS2_MOUSE_ABSOLUTE_POINTER_DEV;\r
+\r
+#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_ABSOLUTE_POINTER_DEV, AbsolutePointerProtocol, PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE)\r
+\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseAbsolutePointerDriver;\r
+extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseAbsolutePointerComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseAbsolutePointerComponentName2;\r
+\r
+//\r
+// Function prototypes\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PS2MouseAbsolutePointerDriverStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE *ChildHandleBuffer\r
+ );\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+ This function retrieves the user readable name of a driver in the form of a\r
+ Unicode string. If the driver specified by This has a user readable name in\r
+ the language specified by Language, then a pointer to the driver name is\r
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+ by This does not support the language specified by Language,\r
+ then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+ @param Language[in] A pointer to a Null-terminated ASCII string\r
+ array indicating the language. This is the\r
+ language of the driver name that the caller is\r
+ requesting, and it must match one of the\r
+ languages specified in SupportedLanguages. The\r
+ number of languages supported by a driver is up\r
+ to the driver writer. Language is specified\r
+ in RFC 3066 or ISO 639-2 language code format.\r
+\r
+ @param DriverName[out] A pointer to the Unicode string to return.\r
+ This Unicode string is the name of the\r
+ driver specified by This in the language\r
+ specified by Language.\r
+\r
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
+ This and the language specified by Language was\r
+ returned in DriverName.\r
+\r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Ps2MouseAbsolutePointerComponentNameGetDriverName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **DriverName\r
+ );\r
+\r
+\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the controller\r
+ that is being managed by a driver.\r
+\r
+ This function retrieves the user readable name of the controller specified by\r
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+ driver specified by This has a user readable name in the language specified by\r
+ Language, then a pointer to the controller name is returned in ControllerName,\r
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
+ managing the controller specified by ControllerHandle and ChildHandle,\r
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+ @param ControllerHandle[in] The handle of a controller that the driver\r
+ specified by This is managing. This handle\r
+ specifies the controller whose name is to be\r
+ returned.\r
+\r
+ @param ChildHandle[in] The handle of the child controller to retrieve\r
+ the name of. This is an optional parameter that\r
+ may be NULL. It will be NULL for device\r
+ drivers. It will also be NULL for a bus drivers\r
+ that wish to retrieve the name of the bus\r
+ controller. It will not be NULL for a bus\r
+ driver that wishes to retrieve the name of a\r
+ child controller.\r
+\r
+ @param Language[in] A pointer to a Null-terminated ASCII string\r
+ array indicating the language. This is the\r
+ language of the driver name that the caller is\r
+ requesting, and it must match one of the\r
+ languages specified in SupportedLanguages. The\r
+ number of languages supported by a driver is up\r
+ to the driver writer. Language is specified in\r
+ RFC 3066 or ISO 639-2 language code format.\r
+\r
+ @param ControllerName[out] A pointer to the Unicode string to return.\r
+ This Unicode string is the name of the\r
+ controller specified by ControllerHandle and\r
+ ChildHandle in the language specified by\r
+ Language from the point of view of the driver\r
+ specified by This.\r
+\r
+ @retval EFI_SUCCESS The Unicode string for the user readable name in\r
+ the language specified by Language for the\r
+ driver specified by This was returned in\r
+ DriverName.\r
+\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+ EFI_HANDLE.\r
+\r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
+ managing the controller specified by\r
+ ControllerHandle and ChildHandle.\r
+\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Ps2MouseAbsolutePointerComponentNameGetControllerName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **ControllerName\r
+ );\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MouseAbsolutePointerReset (\r
+ IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MouseAbsolutePointerGetState (\r
+ IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+ IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+MouseAbsolutePointerWaitForInput (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+PollMouseAbsolutePointer (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ );\r
+\r
+EFI_STATUS\r
+In8042Data (\r
+ IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
+ IN OUT UINT8 *Data\r
+ );\r
+BOOLEAN\r
+CheckMouseAbsolutePointerConnect (\r
+ IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev\r
+ );\r
+\r
+#endif\r
--- /dev/null
+#/** @file\r
+# Ps2 Mouse Simulate TouchPad Driver\r
+#\r
+# This dirver directly uses IsaIo protocol service to support a faked Ps2 TouchPad work.\r
+# Copyright (c) 2006 - 2007, Intel Corporation.\r
+#\r
+# Copyright (c) 2006 - 2007, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = Ps2MouseAbsolutePointerDxe\r
+ FILE_GUID = 2899C94A-1FB6-4b1a-B96B-8364975303E0\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+ ENTRY_POINT = InitializePs2MouseAbsolutePointer\r
+\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+\r
+[Sources.common]\r
+ ComponentName.c\r
+ CommPs2.h\r
+ CommPs2.c\r
+ Ps2MouseAbsolutePointer.h\r
+ Ps2MouseAbsolutePointer.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ ReportStatusCodeLib\r
+ UefiBootServicesTableLib\r
+ MemoryAllocationLib\r
+ BaseMemoryLib\r
+ UefiLib\r
+ UefiDriverEntryPoint\r
+ DebugLib\r
+\r
+[Protocols]\r
+ gEfiIsaIoProtocolGuid # PROTOCOL TO_START\r
+ gEfiAbsolutePointerProtocolGuid # PROTOCOL BY_START\r
+ gEfiDevicePathProtocolGuid # PROTOCOL TO_START\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>Ps2MouseAbsolutePointer</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>2899C94A-1FB6-4b1a-B96B-8364975303E0</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Ps2 Mouse Absolute Pointer Driver</Abstract>\r
+ <Description>This dirver directly uses IsaIo protocol service to support a faked Ps2 touchpad work.</Description>\r
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>Ps2MouseAbsolutePointer</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiDriverModelLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiDriverEntryPoint</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>MemoryAllocationLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiBootServicesTableLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>ReportStatusCodeLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>Ps2MouseAbsolutePointer.c</Filename>\r
+ <Filename>Ps2MouseAbsolutePointer.h</Filename>\r
+ <Filename>CommPs2.c</Filename>\r
+ <Filename>CommPs2.h</Filename>\r
+ <Filename>ComponentName.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Protocols>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="BY_START">\r
+ <ProtocolCName>gEfiAbsolutePointerProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiIsaIoProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ </Protocols>\r
+ <Events>\r
+ <CreateEvents>\r
+ <EventTypes Usage="ALWAYS_PRODUCED">\r
+ <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>\r
+ <HelpText>Set up a time event to wait for the faked touchpad input</HelpText>\r
+ </EventTypes>\r
+ <EventTypes Usage="ALWAYS_PRODUCED">\r
+ <EventType>EVENT_TYPE_PERIODIC_TIMER</EventType>\r
+ <HelpText>Set up a periodic timer to poll the faked touchpad state at a fixed interval</HelpText>\r
+ </EventTypes>\r
+ </CreateEvents>\r
+ <SignalEvents>\r
+ <EventTypes Usage="SOMETIMES_PRODUCED">\r
+ <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>\r
+ <HelpText>Signal an event whenever these is a pending event from the faked touchpad input</HelpText>\r
+ </EventTypes>\r
+ </SignalEvents>\r
+ </Events>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <DriverBinding>gPS2MouseAbsolutePointerDriver</DriverBinding>\r
+ <ComponentName>gPs2MouseAbsolutePointerComponentName</ComponentName>\r
+ </Extern>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
+++ /dev/null
-/**@file\r
- A faked PS/2 Touchpad driver. Routines that interacts with callers,\r
- conforming to EFI driver model\r
- \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "Ps2MouseSimulateTouchPad.h"\r
-#include "CommPs2.h"\r
-\r
-//\r
-// DriverBinding Protocol Instance\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gPS2MouseSimulateTouchPadDriver = {\r
- PS2MouseSimulateTouchPadDriverSupported,\r
- PS2MouseSimulateTouchPadDriverStart,\r
- PS2MouseSimulateTouchPadDriverStop,\r
- 0x1,\r
- NULL,\r
- NULL\r
-};\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- ControllerDriver Protocol Method\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
-// GC_TODO: This - add argument and description to function comment\r
-// GC_TODO: Controller - add argument and description to function comment\r
-// GC_TODO: RemainingDevicePath - add argument and description to function comment\r
-{\r
- EFI_STATUS Status;\r
- EFI_ISA_IO_PROTOCOL *IsaIo;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- //\r
- // Open the IO Abstraction(s) needed to perform the supported test\r
- //\r
- Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiIsaIoProtocolGuid,\r
- (VOID **) &IsaIo,\r
- This->DriverBindingHandle,\r
- Controller,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- //\r
- // Use the ISA I/O Protocol to see if Controller is the Mouse controller\r
- //\r
- switch (IsaIo->ResourceList->Device.HID) {\r
- case EISA_PNP_ID (0xF03):\r
- //\r
- // Microsoft PS/2 style mouse\r
- //\r
- case EISA_PNP_ID (0xF13):\r
- //\r
- // PS/2 Port for PS/2-style Mice\r
- //\r
- break;\r
-\r
- case EISA_PNP_ID (0x303):\r
- //\r
- // IBM Enhanced (101/102-key, PS/2 mouse support)\r
- //\r
- if (IsaIo->ResourceList->Device.UID == 1) {\r
- break;\r
- }\r
-\r
- default:\r
- Status = EFI_UNSUPPORTED;\r
- break;\r
- }\r
- //\r
- // Close the I/O Abstraction(s) used to perform the supported test\r
- //\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiIsaIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
-\r
- return Status;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Start protocol interfaces for the mouse device handles.\r
-\r
-Arguments:\r
- This - Protocol instance pointer.\r
- Controller - Handle of device to bind driver to.\r
- RemainingDevicePath - Not used.\r
-\r
-Returns:\r
- EFI_SUCCESS - This driver is added to DeviceHandle.\r
- other - Errors occurred.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS EmptyStatus;\r
- EFI_ISA_IO_PROTOCOL *IsaIo;\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
- UINT8 Data;\r
- EFI_TPL OldTpl;\r
- EFI_STATUS_CODE_VALUE StatusCode;\r
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
-\r
- StatusCode = 0;\r
- MouseSimulateTouchPadDev = NULL;\r
- IsaIo = NULL;\r
-\r
- //\r
- // Open the device path protocol\r
- //\r
- Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &ParentDevicePath,\r
- This->DriverBindingHandle,\r
- Controller,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- //\r
- // Report that the keyboard is being enabled\r
- //\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_PROGRESS_CODE,\r
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE,\r
- ParentDevicePath\r
- );\r
-\r
- //\r
- // Get the ISA I/O Protocol on Controller's handle\r
- //\r
- Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiIsaIoProtocolGuid,\r
- (VOID **) &IsaIo,\r
- This->DriverBindingHandle,\r
- Controller,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
- if (EFI_ERROR (Status)) {\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Raise TPL to avoid keyboard operation impact\r
- //\r
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
-\r
- //\r
- // Allocate private data\r
- //\r
- MouseSimulateTouchPadDev = AllocateZeroPool (sizeof (PS2_MOUSE_SIMULATE_TOUCHPAD_DEV));\r
- if (MouseSimulateTouchPadDev == NULL) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto ErrorExit;\r
- }\r
- //\r
- // Setup the device instance\r
- //\r
- MouseSimulateTouchPadDev->Signature = PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE;\r
- MouseSimulateTouchPadDev->Handle = Controller;\r
- MouseSimulateTouchPadDev->SampleRate = SSR_20;\r
- MouseSimulateTouchPadDev->Resolution = CMR4;\r
- MouseSimulateTouchPadDev->Scaling = SF1;\r
- MouseSimulateTouchPadDev->DataPackageSize = 3;\r
- MouseSimulateTouchPadDev->IsaIo = IsaIo;\r
- MouseSimulateTouchPadDev->DevicePath = ParentDevicePath;\r
-\r
- //\r
- // Resolution = 4 counts/mm\r
- //\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMaxX = 1024;\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMinX = 0;\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMaxY = 798;\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMinY = 0;\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMaxZ = 0;\r
- MouseSimulateTouchPadDev->Mode.AbsoluteMinZ = 0;\r
- MouseSimulateTouchPadDev->Mode.Attributes = 0x03;\r
-\r
- MouseSimulateTouchPadDev->AbsolutePointerProtocol.Reset = MouseSimulateTouchPadReset;\r
- MouseSimulateTouchPadDev->AbsolutePointerProtocol.GetState = MouseSimulateTouchPadGetState;\r
- MouseSimulateTouchPadDev->AbsolutePointerProtocol.Mode = &(MouseSimulateTouchPadDev->Mode);\r
-\r
- //\r
- // Initialize keyboard controller if necessary\r
- //\r
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);\r
- if ((Data & KBC_SYSF) != KBC_SYSF) {\r
- Status = KbcSelfTest (IsaIo);\r
- if (EFI_ERROR (Status)) {\r
- StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR;\r
- goto ErrorExit;\r
- }\r
- }\r
-\r
- KbcEnableAux (IsaIo);\r
-\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_PROGRESS_CODE,\r
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT,\r
- ParentDevicePath\r
- );\r
-\r
- //\r
- // Reset the mouse\r
- //\r
- Status = MouseSimulateTouchPadDev->AbsolutePointerProtocol.Reset (&MouseSimulateTouchPadDev->AbsolutePointerProtocol, TRUE);\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // mouse not connected\r
- //\r
- Status = EFI_SUCCESS;\r
- StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;\r
- goto ErrorExit;\r
- }\r
- //\r
- // Setup the WaitForKey event\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- MouseSimulateTouchPadWaitForInput,\r
- MouseSimulateTouchPadDev,\r
- &((MouseSimulateTouchPadDev->AbsolutePointerProtocol).WaitForInput)\r
- );\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto ErrorExit;\r
- }\r
- //\r
- // Setup a periodic timer, used to poll mouse state\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
- TPL_NOTIFY,\r
- PollMouseSimulateTouchPad,\r
- MouseSimulateTouchPadDev,\r
- &MouseSimulateTouchPadDev->TimerEvent\r
- );\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto ErrorExit;\r
- }\r
- //\r
- // Start timer to poll mouse (100 samples per second)\r
- //\r
- Status = gBS->SetTimer (MouseSimulateTouchPadDev->TimerEvent, TimerPeriodic, 100000);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto ErrorExit;\r
- }\r
-\r
- MouseSimulateTouchPadDev->ControllerNameTable = NULL;\r
- AddUnicodeString2 (\r
- "eng",\r
- gPs2MouseSimulateTouchPadComponentName.SupportedLanguages,\r
- &MouseSimulateTouchPadDev->ControllerNameTable,\r
- L"Faked PS/2 Touchpad Device",\r
- TRUE\r
- );\r
- AddUnicodeString2 (\r
- "en",\r
- gPs2MouseSimulateTouchPadComponentName2.SupportedLanguages,\r
- &MouseSimulateTouchPadDev->ControllerNameTable,\r
- L"Faked PS/2 Touchpad Device",\r
- FALSE\r
- );\r
-\r
-\r
- //\r
- // Install protocol interfaces for the mouse device.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &Controller,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- &MouseSimulateTouchPadDev->AbsolutePointerProtocol,\r
- NULL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto ErrorExit;\r
- }\r
-\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return Status;\r
-\r
-ErrorExit:\r
-\r
- KbcDisableAux (IsaIo);\r
-\r
- if (StatusCode != 0) {\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
- StatusCode,\r
- ParentDevicePath\r
- );\r
- }\r
-\r
- if ((MouseSimulateTouchPadDev != NULL) && (MouseSimulateTouchPadDev->AbsolutePointerProtocol.WaitForInput != NULL)) {\r
- gBS->CloseEvent (MouseSimulateTouchPadDev->AbsolutePointerProtocol.WaitForInput);\r
- }\r
-\r
- if ((MouseSimulateTouchPadDev != NULL) && (MouseSimulateTouchPadDev->TimerEvent != NULL)) {\r
- gBS->CloseEvent (MouseSimulateTouchPadDev->TimerEvent);\r
- }\r
-\r
- if ((MouseSimulateTouchPadDev != NULL) && (MouseSimulateTouchPadDev->ControllerNameTable != NULL)) {\r
- FreeUnicodeStringTable (MouseSimulateTouchPadDev->ControllerNameTable);\r
- }\r
- //\r
- // Since there will be no timer handler for mouse input any more,\r
- // exhaust input data just in case there is still mouse data left\r
- //\r
- EmptyStatus = EFI_SUCCESS;\r
- while (!EFI_ERROR (EmptyStatus)) {\r
- EmptyStatus = In8042Data (IsaIo, &Data);\r
- }\r
-\r
- if (MouseSimulateTouchPadDev != NULL) {\r
- gBS->FreePool (MouseSimulateTouchPadDev);\r
- }\r
-\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
-\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiIsaIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
-\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return Status;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Arguments:\r
-\r
- Returns:\r
-\r
---*/\r
-// GC_TODO: This - add argument and description to function comment\r
-// GC_TODO: Controller - add argument and description to function comment\r
-// GC_TODO: NumberOfChildren - add argument and description to function comment\r
-// GC_TODO: ChildHandleBuffer - add argument and description to function comment\r
-// GC_TODO: EFI_SUCCESS - add return value to function comment\r
-// GC_TODO: EFI_SUCCESS - add return value to function comment\r
-{\r
- EFI_STATUS Status;\r
- EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
- UINT8 Data;\r
-\r
- Status = gBS->OpenProtocol (\r
- Controller,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- (VOID **) &AbsolutePointerProtocol,\r
- This->DriverBindingHandle,\r
- Controller,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- MouseSimulateTouchPadDev = PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_THIS (AbsolutePointerProtocol);\r
-\r
- //\r
- // Report that the keyboard is being disabled\r
- //\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_PROGRESS_CODE,\r
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE,\r
- MouseSimulateTouchPadDev->DevicePath\r
- );\r
-\r
- Status = gBS->UninstallProtocolInterface (\r
- Controller,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- &MouseSimulateTouchPadDev->AbsolutePointerProtocol\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- //\r
- // Disable mouse on keyboard controller\r
- //\r
- KbcDisableAux (MouseSimulateTouchPadDev->IsaIo);\r
-\r
- //\r
- // Cancel mouse data polling timer, close timer event\r
- //\r
- gBS->SetTimer (MouseSimulateTouchPadDev->TimerEvent, TimerCancel, 0);\r
- gBS->CloseEvent (MouseSimulateTouchPadDev->TimerEvent);\r
-\r
- //\r
- // Since there will be no timer handler for mouse input any more,\r
- // exhaust input data just in case there is still mouse data left\r
- //\r
- Status = EFI_SUCCESS;\r
- while (!EFI_ERROR (Status)) {\r
- Status = In8042Data (MouseSimulateTouchPadDev->IsaIo, &Data);\r
- }\r
-\r
- gBS->CloseEvent (MouseSimulateTouchPadDev->AbsolutePointerProtocol.WaitForInput);\r
- FreeUnicodeStringTable (MouseSimulateTouchPadDev->ControllerNameTable);\r
- gBS->FreePool (MouseSimulateTouchPadDev);\r
-\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
-\r
- gBS->CloseProtocol (\r
- Controller,\r
- &gEfiIsaIoProtocolGuid,\r
- This->DriverBindingHandle,\r
- Controller\r
- );\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MouseSimulateTouchPadReset (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system\r
-\r
-Arguments:\r
-\r
- This - Pointer of simple pointer Protocol.\r
- ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - The command byte is written successfully.\r
- EFI_DEVICE_ERROR - Errors occurred during reseting keyboard.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
- EFI_TPL OldTpl;\r
- BOOLEAN KeyboardEnable;\r
- UINT8 Data;\r
-\r
- MouseSimulateTouchPadDev = PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_THIS (This);\r
-\r
- //\r
- // Report reset progress code\r
- //\r
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
- EFI_PROGRESS_CODE,\r
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET,\r
- MouseSimulateTouchPadDev->DevicePath\r
- );\r
-\r
- KeyboardEnable = FALSE;\r
-\r
- //\r
- // Raise TPL to avoid keyboard operation impact\r
- //\r
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
-\r
- ZeroMem (&MouseSimulateTouchPadDev->State, sizeof (EFI_ABSOLUTE_POINTER_STATE));\r
- MouseSimulateTouchPadDev->StateChanged = FALSE;\r
-\r
- //\r
- // Exhaust input data\r
- //\r
- Status = EFI_SUCCESS;\r
- while (!EFI_ERROR (Status)) {\r
- Status = In8042Data (MouseSimulateTouchPadDev->IsaIo, &Data);\r
- }\r
-\r
- CheckKbStatus (MouseSimulateTouchPadDev->IsaIo, &KeyboardEnable);\r
-\r
- KbcDisableKb (MouseSimulateTouchPadDev->IsaIo);\r
-\r
- MouseSimulateTouchPadDev->IsaIo->Io.Read (MouseSimulateTouchPadDev->IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);\r
-\r
- //\r
- // if there's data block on KBC data port, read it out\r
- //\r
- if ((Data & KBC_OUTB) == KBC_OUTB) {\r
- MouseSimulateTouchPadDev->IsaIo->Io.Read (MouseSimulateTouchPadDev->IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Data);\r
- }\r
-\r
- Status = EFI_SUCCESS;\r
- //\r
- // The PS2 mouse driver reset behavior is always successfully return no matter wheater or not there is mouse connected to system.\r
- // This behavior is needed by performance speed. The following mouse command only succeessfully finish when mouse device is\r
- // connected to system, so if PS2 mouse device not connect to system or user not ask for, we skip the mouse configuration and enabling\r
- //\r
- if (ExtendedVerification && CheckMouseSimulateTouchPadConnect (MouseSimulateTouchPadDev)) {\r
- //\r
- // Send mouse reset command and set mouse default configure\r
- //\r
- Status = PS2MouseReset (MouseSimulateTouchPadDev->IsaIo);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_DEVICE_ERROR;\r
- goto Exit;\r
- }\r
-\r
- Status = PS2MouseSetSampleRate (MouseSimulateTouchPadDev->IsaIo, MouseSimulateTouchPadDev->SampleRate);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_DEVICE_ERROR;\r
- goto Exit;\r
- }\r
-\r
- Status = PS2MouseSetResolution (MouseSimulateTouchPadDev->IsaIo, MouseSimulateTouchPadDev->Resolution);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_DEVICE_ERROR;\r
- goto Exit;\r
- }\r
-\r
- Status = PS2MouseSetScaling (MouseSimulateTouchPadDev->IsaIo, MouseSimulateTouchPadDev->Scaling);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_DEVICE_ERROR;\r
- goto Exit;\r
- }\r
-\r
- Status = PS2MouseEnable (MouseSimulateTouchPadDev->IsaIo);\r
- if (EFI_ERROR (Status)) {\r
- Status = EFI_DEVICE_ERROR;\r
- goto Exit;\r
- }\r
- }\r
-Exit:\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- if (KeyboardEnable) {\r
- KbcEnableKb (MouseSimulateTouchPadDev->IsaIo);\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-BOOLEAN\r
-CheckMouseSimulateTouchPadConnect (\r
- IN PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Check whether there is Ps/2 mouse device in system\r
-\r
-Arguments:\r
-\r
- PS2_MOUSE_DEV - Mouse Private Data Structure\r
-\r
-Returns:\r
-\r
- TRUE - Keyboard in System.\r
- FALSE - Keyboard not in System.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = PS2MouseEnable (MouseSimulateTouchPadDev->IsaIo);\r
- if (!EFI_ERROR (Status)) {\r
- return TRUE;\r
- }\r
-\r
- return FALSE;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MouseSimulateTouchPadGetState (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- This - GC_TODO: add argument description\r
- State - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- EFI_INVALID_PARAMETER - GC_TODO: Add description for return value\r
- EFI_NOT_READY - GC_TODO: Add description for return value\r
- EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
-{\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
- EFI_TPL OldTpl;\r
-\r
- MouseSimulateTouchPadDev = PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_THIS (This);\r
-\r
- if (State == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- if (!MouseSimulateTouchPadDev->StateChanged) {\r
- return EFI_NOT_READY;\r
- }\r
-\r
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
- CopyMem (State, &(MouseSimulateTouchPadDev->State), sizeof (EFI_ABSOLUTE_POINTER_STATE));\r
-\r
- //\r
- // clear mouse state\r
- //\r
- MouseSimulateTouchPadDev->State.CurrentX = 0;\r
- MouseSimulateTouchPadDev->State.CurrentY = 0;\r
- MouseSimulateTouchPadDev->State.CurrentZ = 0;\r
- MouseSimulateTouchPadDev->State.ActiveButtons = 0x0;\r
- MouseSimulateTouchPadDev->StateChanged = FALSE;\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-MouseSimulateTouchPadWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Event notification function for SIMPLE_POINTER.WaitForInput event\r
- Signal the event if there is input from mouse\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
-// GC_TODO: Event - add argument and description to function comment\r
-// GC_TODO: Context - add argument and description to function comment\r
-{\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
-\r
- MouseSimulateTouchPadDev = (PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *) Context;\r
-\r
- //\r
- // Someone is waiting on the mouse event, if there's\r
- // input from mouse, signal the event\r
- //\r
- if (MouseSimulateTouchPadDev->StateChanged) {\r
- gBS->SignalEvent (Event);\r
- }\r
-\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-PollMouseSimulateTouchPad(\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Event notification function for TimerEvent event\r
- If mouse device is connected to system, try to get the mouse packet data\r
-\r
-Arguments:\r
-\r
- Event - TimerEvent in PS2_MOUSE_DEV\r
- Context - Pointer to PS2_MOUSE_DEV structure\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-{\r
- PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev;\r
-\r
- MouseSimulateTouchPadDev = (PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *) Context;\r
-\r
- //\r
- // Polling mouse packet data\r
- //\r
- PS2MouseGetPacket (MouseSimulateTouchPadDev);\r
-}\r
-\r
-/**\r
- The user Entry Point for module Ps2MouseSimulateTouchPad. The user code starts with this function.\r
-\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
- @param[in] SystemTable A pointer to the EFI System Table.\r
- \r
- @retval EFI_SUCCESS The entry point is executed successfully.\r
- @retval other Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializePs2MouseSimulateTouchPad(\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Install driver model protocol(s).\r
- //\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gPS2MouseSimulateTouchPadDriver,\r
- ImageHandle,\r
- &gPs2MouseSimulateTouchPadComponentName,\r
- &gPs2MouseSimulateTouchPadComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
-\r
- return Status;\r
-}\r
+++ /dev/null
-/**@file\r
- A faked PS/2 Touchpad driver header file\r
- \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _PS2MOUSESIMULATETOUCHPAD_H\r
-#define _PS2MOUSESIMULATETOUCHPAD_H\r
-\r
-#include <PiDxe.h>\r
-#include <Framework/StatusCode.h>\r
-\r
-#include <Protocol/AbsolutePointer.h>\r
-#include <Protocol/IsaIo.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-\r
-//\r
-// PS/2 mouse sample rate\r
-//\r
-typedef enum {\r
- SSR_10,\r
- SSR_20,\r
- SSR_40,\r
- SSR_60,\r
- SSR_80,\r
- SSR_100,\r
- SSR_200,\r
- MAX_SR\r
-} MOUSE_SR;\r
-\r
-//\r
-// PS/2 mouse resolution\r
-//\r
-typedef enum {\r
- CMR1,\r
- CMR2,\r
- CMR4,\r
- CMR8,\r
- MAX_CMR\r
-} MOUSE_RE;\r
-\r
-//\r
-// PS/2 mouse scaling\r
-//\r
-typedef enum {\r
- SF1,\r
- SF2\r
-} MOUSE_SF;\r
-\r
-//\r
-// Driver Private Data\r
-//\r
-#define PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE EFI_SIGNATURE_32 ('p', '2', 's', 't')\r
-\r
-typedef struct {\r
- UINTN Signature;\r
-\r
- EFI_HANDLE Handle;\r
- EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol;\r
- EFI_ABSOLUTE_POINTER_STATE State;\r
- EFI_ABSOLUTE_POINTER_MODE Mode;\r
- BOOLEAN StateChanged;\r
-\r
- //\r
- // PS2 Mouse device specific information\r
- //\r
- MOUSE_SR SampleRate;\r
- MOUSE_RE Resolution;\r
- MOUSE_SF Scaling;\r
- UINT8 DataPackageSize;\r
-\r
- EFI_ISA_IO_PROTOCOL *IsaIo;\r
-\r
- EFI_EVENT TimerEvent;\r
-\r
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
-} PS2_MOUSE_SIMULATE_TOUCHPAD_DEV;\r
-\r
-#define PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_SIMULATE_TOUCHPAD_DEV, AbsolutePointerProtocol, PS2_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE)\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseSimulateTouchPadDriver;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseSimulateTouchPadComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseSimulateTouchPadComponentName2;\r
-\r
-//\r
-// Function prototypes\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PS2MouseSimulateTouchPadDriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 3066 or ISO 639-2 language code format.\r
-\r
- @param DriverName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ps2MouseSimulateTouchPadComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 3066 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ps2MouseSimulateTouchPadComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MouseSimulateTouchPadReset (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MouseSimulateTouchPadGetState (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
- );\r
-\r
-VOID\r
-EFIAPI\r
-MouseSimulateTouchPadWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-VOID\r
-EFIAPI\r
-PollMouseSimulateTouchPad (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-EFI_STATUS\r
-In8042Data (\r
- IN EFI_ISA_IO_PROTOCOL *IsaIo,\r
- IN OUT UINT8 *Data\r
- );\r
-BOOLEAN\r
-CheckMouseSimulateTouchPadConnect (\r
- IN PS2_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseDev\r
- );\r
-\r
-#endif\r
+++ /dev/null
-#/** @file\r
-# Ps2 Mouse Simulate TouchPad Driver\r
-#\r
-# This dirver directly uses IsaIo protocol service to support a faked Ps2 TouchPad work.\r
-# Copyright (c) 2006 - 2007, Intel Corporation.\r
-#\r
-# Copyright (c) 2006 - 2007, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = Ps2MouseSimulateTouchPadDxe\r
- FILE_GUID = 2899C94A-1FB6-4b1a-B96B-8364975303E0\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
- EDK_RELEASE_VERSION = 0x00020000\r
- EFI_SPECIFICATION_VERSION = 0x00020000\r
-\r
- ENTRY_POINT = InitializePs2MouseSimulateTouchPad\r
-\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-\r
-[Sources.common]\r
- ComponentName.c\r
- CommPs2.h\r
- CommPs2.c\r
- Ps2MouseSimulateTouchPad.h\r
- Ps2MouseSimulateTouchPad.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- IntelFrameworkPkg/IntelFrameworkPkg.dec\r
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
-\r
-[LibraryClasses]\r
- ReportStatusCodeLib\r
- UefiBootServicesTableLib\r
- MemoryAllocationLib\r
- BaseMemoryLib\r
- UefiLib\r
- UefiDriverEntryPoint\r
- DebugLib\r
-\r
-[Protocols]\r
- gEfiIsaIoProtocolGuid # PROTOCOL TO_START\r
- gEfiAbsolutePointerProtocolGuid # PROTOCOL BY_START\r
- gEfiDevicePathProtocolGuid # PROTOCOL TO_START\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
- <MsaHeader>\r
- <ModuleName>Ps2MouseSimulateTouchPad</ModuleName>\r
- <ModuleType>DXE_DRIVER</ModuleType>\r
- <GuidValue>2899C94A-1FB6-4b1a-B96B-8364975303E0</GuidValue>\r
- <Version>1.0</Version>\r
- <Abstract>Ps2 Mouse Simulate Touchpad Driver</Abstract>\r
- <Description>This dirver directly uses IsaIo protocol service to support a faked Ps2 touchpad work.</Description>\r
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
- <License>All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
- </MsaHeader>\r
- <ModuleDefinitions>\r
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
- <BinaryModule>false</BinaryModule>\r
- <OutputFileBasename>Ps2MouseSimulateTouchPad</OutputFileBasename>\r
- </ModuleDefinitions>\r
- <LibraryClassDefinitions>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DebugLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiDriverModelLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiDriverEntryPoint</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>BaseMemoryLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>MemoryAllocationLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiBootServicesTableLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>ReportStatusCodeLib</Keyword>\r
- </LibraryClass>\r
- </LibraryClassDefinitions>\r
- <SourceFiles>\r
- <Filename>Ps2MouseSimulateTouchPad.c</Filename>\r
- <Filename>Ps2MouseSimulateTouchPad.h</Filename>\r
- <Filename>CommPs2.c</Filename>\r
- <Filename>CommPs2.h</Filename>\r
- <Filename>ComponentName.c</Filename>\r
- </SourceFiles>\r
- <PackageDependencies>\r
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
- </PackageDependencies>\r
- <Protocols>\r
- <Protocol Usage="TO_START">\r
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>\r
- </Protocol>\r
- <Protocol Usage="BY_START">\r
- <ProtocolCName>gEfiAbsolutePointerProtocolGuid</ProtocolCName>\r
- </Protocol>\r
- <Protocol Usage="TO_START">\r
- <ProtocolCName>gEfiIsaIoProtocolGuid</ProtocolCName>\r
- </Protocol>\r
- </Protocols>\r
- <Events>\r
- <CreateEvents>\r
- <EventTypes Usage="ALWAYS_PRODUCED">\r
- <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>\r
- <HelpText>Set up a time event to wait for the faked touchpad input</HelpText>\r
- </EventTypes>\r
- <EventTypes Usage="ALWAYS_PRODUCED">\r
- <EventType>EVENT_TYPE_PERIODIC_TIMER</EventType>\r
- <HelpText>Set up a periodic timer to poll the faked touchpad state at a fixed interval</HelpText>\r
- </EventTypes>\r
- </CreateEvents>\r
- <SignalEvents>\r
- <EventTypes Usage="SOMETIMES_PRODUCED">\r
- <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>\r
- <HelpText>Signal an event whenever these is a pending event from the faked touchpad input</HelpText>\r
- </EventTypes>\r
- </SignalEvents>\r
- </Events>\r
- <Externs>\r
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
- <Extern>\r
- <DriverBinding>gPS2MouseSimulateTouchPadDriver</DriverBinding>\r
- <ComponentName>gPs2MouseSimulateTouchPadComponentName</ComponentName>\r
- </Extern>\r
- </Externs>\r
-</ModuleSurfaceArea>
\ No newline at end of file