diff options
author | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-28 03:45:35 +0000 |
---|---|---|
committer | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-28 03:45:35 +0000 |
commit | ac4f8b5abe6758183102be3feea30c7430eedf3a (patch) | |
tree | fde5418fd31400290f433a5f409e709f57ff121c | |
parent | 52e6faea636bbd42360d8e151e1abb86df2b3dfc (diff) | |
download | edk2-platforms-ac4f8b5abe6758183102be3feea30c7430eedf3a.tar.xz |
modify the corresponding file path about Ps2MouseAbsolutePointerDxe driver & rename the Ps2MouseSimulateTouchPadDxe folder to Ps2MouseAbsolutePointer
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4340 6f19259b-4bc3-4df7-8a09-765794883524
8 files changed, 1 insertions, 3021 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.c deleted file mode 100644 index 895c1c25a5..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.c +++ /dev/null @@ -1,1094 +0,0 @@ -/**@file
- PS2 Mouse Communication Interface
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Ps2MouseAbsolutePointer.h"
-#include "CommPs2.h"
-
-UINT8 SampleRateTbl[MAX_SR] = { 0xa, 0x14, 0x28, 0x3c, 0x50, 0x64, 0xc8 };
-
-UINT8 ResolutionTbl[MAX_CMR] = { 0, 1, 2, 3 };
-
-EFI_STATUS
-KbcSelfTest (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Data;
-
- //
- // Keyboard controller self test
- //
- Status = Out8042Command (IsaIo, SELF_TEST);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Read return code
- //
- Status = In8042Data (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Data != 0x55) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Set system flag
- //
- Status = Out8042Command (IsaIo, READ_CMD_BYTE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = In8042Data (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = Out8042Command (IsaIo, WRITE_CMD_BYTE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Data |= CMD_SYS_FLAG;
- Status = Out8042Data (IsaIo, Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-KbcEnableAux (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- //
- // Send 8042 enable mouse command
- //
- return Out8042Command (IsaIo, ENABLE_AUX);
-}
-
-EFI_STATUS
-KbcDisableAux (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- //
- // Send 8042 disable mouse command
- //
- return Out8042Command (IsaIo, DISABLE_AUX);
-}
-
-EFI_STATUS
-KbcEnableKb (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- //
- // Send 8042 enable keyboard command
- //
- return Out8042Command (IsaIo, ENABLE_KB);
-}
-
-EFI_STATUS
-KbcDisableKb (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- //
- // Send 8042 disable keyboard command
- //
- return Out8042Command (IsaIo, DISABLE_KB);
-}
-
-EFI_STATUS
-CheckKbStatus (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- OUT BOOLEAN *KeyboardEnable
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- KeyboardEnable - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Data;
-
- //
- // Send command to read KBC command byte
- //
- Status = Out8042Command (IsaIo, READ_CMD_BYTE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = In8042Data (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check keyboard enable or not
- //
- if ((Data & CMD_KB_STS) == CMD_KB_DIS) {
- *KeyboardEnable = FALSE;
- } else {
- *KeyboardEnable = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PS2MouseReset (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Data;
-
- Status = Out8042AuxCommand (IsaIo, RESET_CMD, FALSE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = In8042AuxData (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check BAT Complete Code
- //
- if (Data != PS2MOUSE_BAT1) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = In8042AuxData (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check BAT Complete Code
- //
- if (Data != PS2MOUSE_BAT2) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PS2MouseSetSampleRate (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_SR SampleRate
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- SampleRate - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Send auxiliary command to set mouse sample rate
- //
- Status = Out8042AuxCommand (IsaIo, SETSR_CMD, FALSE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = Out8042AuxData (IsaIo, SampleRateTbl[SampleRate]);
-
- return Status;
-}
-
-EFI_STATUS
-PS2MouseSetResolution (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_RE Resolution
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Resolution - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Send auxiliary command to set mouse resolution
- //
- Status = Out8042AuxCommand (IsaIo, SETRE_CMD, FALSE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = Out8042AuxData (IsaIo, ResolutionTbl[Resolution]);
-
- return Status;
-}
-
-EFI_STATUS
-PS2MouseSetScaling (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_SF Scaling
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Scaling - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- UINT8 Command;
-
- Command = (UINT8) (Scaling == SF1 ? SETSF1_CMD : SETSF2_CMD);
-
- //
- // Send auxiliary command to set mouse scaling data
- //
- return Out8042AuxCommand (IsaIo, Command, FALSE);
-}
-
-EFI_STATUS
-PS2MouseEnable (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- //
- // Send auxiliary command to enable mouse
- //
- return Out8042AuxCommand (IsaIo, ENABLE_CMD, FALSE);
-}
-
-EFI_STATUS
-PS2MouseGetPacket (
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev
- )
-/*++
-
-Routine Description:
-
- Get mouse packet . Only care first 3 bytes
-
-Arguments:
-
- MouseDev - Pointer of PS2 Mouse Private Data Structure
-
-Returns:
-
- EFI_NOT_READY - Mouse Device not ready to input data packet, or some error happened during getting the packet
- EFI_SUCCESS - The data packet is gotten successfully.
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN KeyboardEnable;
- UINT8 Packet[PS2_PACKET_LENGTH];
- UINT8 Data;
- UINTN Count;
- UINTN State;
- INT16 RelativeMovementX;
- INT16 RelativeMovementY;
- BOOLEAN LButton;
- BOOLEAN RButton;
-
- KeyboardEnable = FALSE;
- Count = 1;
- State = PS2_READ_BYTE_ONE;
-
- //
- // State machine to get mouse packet
- //
- while (1) {
-
- switch (State) {
- case PS2_READ_BYTE_ONE:
- //
- // Read mouse first byte data, if failed, immediately return
- //
- KbcDisableAux (MouseAbsolutePointerDev->IsaIo);
- Status = PS2MouseRead (MouseAbsolutePointerDev->IsaIo, &Data, &Count, State);
- if (EFI_ERROR (Status)) {
- KbcEnableAux (MouseAbsolutePointerDev->IsaIo);
- return EFI_NOT_READY;
- }
-
- if (Count != 1) {
- KbcEnableAux (MouseAbsolutePointerDev->IsaIo);
- return EFI_NOT_READY;
- }
-
- if (IS_PS2_SYNC_BYTE (Data)) {
- Packet[0] = Data;
- State = PS2_READ_DATA_BYTE;
-
- CheckKbStatus (MouseAbsolutePointerDev->IsaIo, &KeyboardEnable);
- KbcDisableKb (MouseAbsolutePointerDev->IsaIo);
- KbcEnableAux (MouseAbsolutePointerDev->IsaIo);
- }
- break;
-
- case PS2_READ_DATA_BYTE:
- Count = 2;
- Status = PS2MouseRead (MouseAbsolutePointerDev->IsaIo, (Packet + 1), &Count, State);
- if (EFI_ERROR (Status)) {
- if (KeyboardEnable) {
- KbcEnableKb (MouseAbsolutePointerDev->IsaIo);
- }
-
- return EFI_NOT_READY;
- }
-
- if (Count != 2) {
- if (KeyboardEnable) {
- KbcEnableKb (MouseAbsolutePointerDev->IsaIo);
- }
-
- return EFI_NOT_READY;
- }
-
- State = PS2_PROCESS_PACKET;
- break;
-
- case PS2_PROCESS_PACKET:
- if (KeyboardEnable) {
- KbcEnableKb (MouseAbsolutePointerDev->IsaIo);
- }
- //
- // Decode the packet
- //
- RelativeMovementX = Packet[1];
- RelativeMovementY = Packet[2];
- //
- // Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
- // Byte 0 | Y overflow | X overflow | Y sign bit | X sign bit | Always 1 | Middle Btn | Right Btn | Left Btn
- // Byte 1 | 8 bit X Movement
- // Byte 2 | 8 bit Y Movement
- //
- // X sign bit + 8 bit X Movement : 9-bit signed twos complement integer that presents the relative displacement of the device in the X direction since the last data transmission.
- // Y sign bit + 8 bit Y Movement : Same as X sign bit + 8 bit X Movement.
- //
- //
- // First, Clear X and Y high 8 bits
- //
- RelativeMovementX = (INT16) (RelativeMovementX & 0xFF);
- RelativeMovementY = (INT16) (RelativeMovementY & 0xFF);
- //
- // Second, if the 9-bit signed twos complement integer is negative, set the high 8 bit 0xff
- //
- if ((Packet[0] & 0x10) != 0) {
- RelativeMovementX = (INT16) (RelativeMovementX | 0xFF00);
- }
- if ((Packet[0] & 0x20) != 0) {
- RelativeMovementY = (INT16) (RelativeMovementY | 0xFF00);
- }
-
-
- RButton = (UINT8) (Packet[0] & 0x2);
- LButton = (UINT8) (Packet[0] & 0x1);
-
- //
- // Update mouse state
- //
- MouseAbsolutePointerDev->State.CurrentX += RelativeMovementX;
- MouseAbsolutePointerDev->State.CurrentY -= RelativeMovementY;
- MouseAbsolutePointerDev->State.CurrentZ = 0;
- MouseAbsolutePointerDev->State.ActiveButtons = (UINT8) (LButton || RButton) & 0x3;
- MouseAbsolutePointerDev->StateChanged = TRUE;
-
- return EFI_SUCCESS;
- }
- }
-}
-
-EFI_STATUS
-PS2MouseRead (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- OUT VOID *Buffer,
- IN OUT UINTN *BufSize,
- IN UINTN State
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Buffer - GC_TODO: add argument description
- BufSize - GC_TODO: add argument description
- State - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINTN BytesRead;
-
- Status = EFI_SUCCESS;
- BytesRead = 0;
-
- if (State == PS2_READ_BYTE_ONE) {
- //
- // Check input for mouse
- //
- Status = CheckForInput (IsaIo);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- while (BytesRead < *BufSize) {
-
- Status = WaitOutputFull (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, Buffer);
-
- BytesRead++;
- Buffer = (UINT8 *) Buffer + 1;
- }
- //
- // Verify the correct number of bytes read
- //
- if (BytesRead == 0 || BytesRead != *BufSize) {
- Status = EFI_NOT_FOUND;
- }
-
- *BufSize = BytesRead;
- return Status;
-}
-//
-// 8042 I/O function
-//
-EFI_STATUS
-Out8042Command (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Command
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Command - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Data;
-
- //
- // Wait keyboard controller input buffer empty
- //
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Send command
- //
- Data = Command;
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Out8042Data (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Data
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Data - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 temp;
- //
- // Wait keyboard controller input buffer empty
- //
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- temp = Data;
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &temp);
-
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-In8042Data (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN OUT UINT8 *Data
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Data - GC_TODO: add argument description
-
-Returns:
-
- EFI_TIMEOUT - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- UINTN Delay;
- UINT8 temp;
-
- Delay = TIMEOUT / 50;
-
- do {
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &temp);
-
- //
- // Check keyboard controller status bit 0(output buffer status)
- //
- if ((temp & KBC_OUTB) == KBC_OUTB) {
- break;
- }
-
- gBS->Stall (50);
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, Data);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Out8042AuxCommand (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Command,
- IN BOOLEAN Resend
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Command - GC_TODO: add argument description
- Resend - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value
- EFI_DEVICE_ERROR - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Data;
-
- //
- // Wait keyboard controller input buffer empty
- //
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Send write to auxiliary device command
- //
- Data = WRITE_AUX_DEV;
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Send auxiliary device command
- //
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Command);
-
- //
- // Read return code
- //
- Status = In8042AuxData (IsaIo, &Data);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Data == PS2_ACK) {
- //
- // Receive mouse acknowledge, command send success
- //
- return EFI_SUCCESS;
-
- } else if (Resend) {
- //
- // Resend fail
- //
- return EFI_DEVICE_ERROR;
-
- } else if (Data == PS2_RESEND) {
- //
- // Resend command
- //
- Status = Out8042AuxCommand (IsaIo, Command, TRUE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- } else {
- //
- // Invalid return code
- //
- return EFI_DEVICE_ERROR;
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Out8042AuxData (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Data
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Data - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINT8 Temp;
- //
- // Wait keyboard controller input buffer empty
- //
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Send write to auxiliary device command
- //
- Temp = WRITE_AUX_DEV;
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Temp);
-
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Temp = Data;
- IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Temp);
-
- Status = WaitInputEmpty (IsaIo, TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-In8042AuxData (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN OUT UINT8 *Data
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Data - GC_TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // wait for output data
- //
- Status = WaitOutputFull (IsaIo, BAT_TIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, Data);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CheckForInput (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- UINT8 Data;
-
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- //
- // Check keyboard controller status, if it is output buffer full and for auxiliary device
- //
- if ((Data & (KBC_OUTB | KBC_AUXB)) != (KBC_OUTB | KBC_AUXB)) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WaitInputEmpty (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Timeout - GC_TODO: add argument description
-
-Returns:
-
- EFI_TIMEOUT - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- UINTN Delay;
- UINT8 Data;
-
- Delay = Timeout / 50;
-
- do {
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- //
- // Check keyboard controller status bit 1(input buffer status)
- //
- if ((Data & KBC_INPB) == 0) {
- break;
- }
-
- gBS->Stall (50);
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WaitOutputFull (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Timeout - GC_TODO: add argument description
-
-Returns:
-
- EFI_TIMEOUT - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- UINTN Delay;
- UINT8 Data;
-
- Delay = Timeout / 50;
-
- do {
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- //
- // Check keyboard controller status bit 0(output buffer status)
- // & bit5(output buffer for auxiliary device)
- //
- if ((Data & (KBC_OUTB | KBC_AUXB)) == (KBC_OUTB | KBC_AUXB)) {
- break;
- }
-
- gBS->Stall (50);
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.h deleted file mode 100644 index 869ac01992..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/CommPs2.h +++ /dev/null @@ -1,430 +0,0 @@ -/**@file
- PS2 Mouse Communication Interface
-
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _COMMPS2_H_
-#define _COMMPS2_H_
-
-#define PS2_PACKET_LENGTH 3
-#define PS2_SYNC_MASK 0xc
-#define PS2_SYNC_BYTE 0x8
-
-#define IS_PS2_SYNC_BYTE(byte) ((byte & PS2_SYNC_MASK) == PS2_SYNC_BYTE)
-
-#define PS2_READ_BYTE_ONE 0
-#define PS2_READ_DATA_BYTE 1
-#define PS2_PROCESS_PACKET 2
-
-#define TIMEOUT 50000
-#define BAT_TIMEOUT 500000
-
-//
-// 8042 I/O Port
-//
-#define KBC_DATA_PORT 0x60
-#define KBC_CMD_STS_PORT 0x64
-
-//
-// 8042 Command
-//
-#define READ_CMD_BYTE 0x20
-#define WRITE_CMD_BYTE 0x60
-#define DISABLE_AUX 0xa7
-#define ENABLE_AUX 0xa8
-#define SELF_TEST 0xaa
-#define DISABLE_KB 0xad
-#define ENABLE_KB 0xae
-#define WRITE_AUX_DEV 0xd4
-
-#define CMD_SYS_FLAG 0x04
-#define CMD_KB_STS 0x10
-#define CMD_KB_DIS 0x10
-#define CMD_KB_EN 0x0
-
-//
-// 8042 Auxiliary Device Command
-//
-#define SETSF1_CMD 0xe6
-#define SETSF2_CMD 0xe7
-#define SETRE_CMD 0xe8
-#define READ_CMD 0xeb
-#define SETRM_CMD 0xf0
-#define SETSR_CMD 0xf3
-#define ENABLE_CMD 0xf4
-#define DISABLE_CMD 0xf5
-#define RESET_CMD 0xff
-
-//
-// return code
-//
-#define PS2_ACK 0xfa
-#define PS2_RESEND 0xfe
-#define PS2MOUSE_BAT1 0xaa
-#define PS2MOUSE_BAT2 0x0
-
-//
-// Keyboard Controller Status
-//
-#define KBC_PARE 0x80 // Parity Error
-#define KBC_TIM 0x40 // General Time Out
-#define KBC_AUXB 0x20 // Output buffer for auxiliary device (PS/2):
-// 0 - Holds keyboard data
-// 1 - Holds data for auxiliary device
-//
-#define KBC_KEYL 0x10 // Keyboard lock status:
-// 0 - keyboard locked
-// 1 - keyboard free
-//
-#define KBC_CD 0x08 // Command/Data:
-// 0 - data byte written via port 60h
-// 1 - command byte written via port 64h
-//
-#define KBC_SYSF 0x04 // System Flag:
-// 0 - power-on reset
-// 1 - self-test successful
-//
-#define KBC_INPB 0x02 // Input Buffer Status :
-// 0 - input buffer empty
-// 1 - CPU data in input buffer
-//
-#define KBC_OUTB 0x01 // Output Buffer Status :
-// 0 - output buffer empty
-// 1 - keyboard controller data in output buffer
-//
-EFI_STATUS
-KbcSelfTest (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-KbcEnableAux (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-KbcDisableAux (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-KbcEnableKb (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-KbcDisableKb (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CheckKbStatus (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- OUT BOOLEAN *KeyboardEnable
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- KeyboardEnable - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseReset (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseSetSampleRate (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_SR SampleRate
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- SampleRate - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseSetResolution (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_RE Resolution
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Resolution - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseSetScaling (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN MOUSE_SF Scaling
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
- Scaling - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseEnable (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- IsaIo - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseGetPacket (
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- MouseDev - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PS2MouseRead (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- OUT VOID *Buffer,
- IN OUT UINTN *BufSize,
- IN UINTN State
- );
-
-//
-// 8042 I/O function
-//
-EFI_STATUS
-Out8042Command (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Command
- );
-
-EFI_STATUS
-In8042Data (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN OUT UINT8 *Data
- );
-
-EFI_STATUS
-Out8042Data (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Data
- );
-
-EFI_STATUS
-Out8042AuxCommand (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Command,
- IN BOOLEAN Resend
- );
-
-EFI_STATUS
-In8042AuxData (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN OUT UINT8 *Data
- );
-
-EFI_STATUS
-Out8042AuxData (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINT8 Data
- );
-
-EFI_STATUS
-CheckForInput (
- IN EFI_ISA_IO_PROTOCOL *IsaIo
- );
-
-EFI_STATUS
-WaitInputEmpty (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINTN Timeout
- );
-
-EFI_STATUS
-WaitOutputFull (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN UINTN Timeout
- );
-
-#endif // _COMMPS2_H_
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/ComponentName.c deleted file mode 100644 index c20e875e51..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/ComponentName.c +++ /dev/null @@ -1,240 +0,0 @@ -/**@file
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Ps2MouseAbsolutePointer.h"
-
-//
-// EFI Component Name Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPs2MouseAbsolutePointerComponentName = {
- Ps2MouseAbsolutePointerComponentNameGetDriverName,
- Ps2MouseAbsolutePointerComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseAbsolutePointerComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseAbsolutePointerComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseAbsolutePointerComponentNameGetControllerName,
- "en"
-};
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseAbsolutePointerDriverNameTable[] = {
- {
- "eng;en",
- L"faked PS/2 Touchpad Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 3066 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-Ps2MouseAbsolutePointerComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mPs2MouseAbsolutePointerDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gPs2MouseAbsolutePointerComponentName)
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 3066 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-Ps2MouseAbsolutePointerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
- EFI_ISA_IO_PROTOCOL *IsaIoProtocol;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Check Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIoProtocol,
- gPS2MouseAbsolutePointerDriver.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiIsaIoProtocolGuid,
- gPS2MouseAbsolutePointerDriver.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiAbsolutePointerProtocolGuid,
- (VOID **) &AbsolutePointerProtocol,
- gPS2MouseAbsolutePointerDriver.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (AbsolutePointerProtocol);
-
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- MouseAbsolutePointerDev->ControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gPs2MouseAbsolutePointerComponentName)
- );
-}
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.c deleted file mode 100644 index 930b49fe9a..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.c +++ /dev/null @@ -1,799 +0,0 @@ -/**@file
- A faked PS/2 Touchpad driver. Routines that interacts with callers,
- conforming to EFI driver model
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Ps2MouseAbsolutePointer.h"
-#include "CommPs2.h"
-
-//
-// DriverBinding Protocol Instance
-//
-EFI_DRIVER_BINDING_PROTOCOL gPS2MouseAbsolutePointerDriver = {
- PS2MouseAbsolutePointerDriverSupported,
- PS2MouseAbsolutePointerDriverStart,
- PS2MouseAbsolutePointerDriverStop,
- 0x1,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- ControllerDriver Protocol Method
-
-Arguments:
-
-Returns:
-
---*/
-// GC_TODO: This - add argument and description to function comment
-// GC_TODO: Controller - add argument and description to function comment
-// GC_TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_ISA_IO_PROTOCOL *IsaIo;
-
- Status = EFI_SUCCESS;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Use the ISA I/O Protocol to see if Controller is the Mouse controller
- //
- switch (IsaIo->ResourceList->Device.HID) {
- case EISA_PNP_ID (0xF03):
- //
- // Microsoft PS/2 style mouse
- //
- case EISA_PNP_ID (0xF13):
- //
- // PS/2 Port for PS/2-style Mice
- //
- break;
-
- case EISA_PNP_ID (0x303):
- //
- // IBM Enhanced (101/102-key, PS/2 mouse support)
- //
- if (IsaIo->ResourceList->Device.UID == 1) {
- break;
- }
-
- default:
- Status = EFI_UNSUPPORTED;
- break;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiIsaIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Start protocol interfaces for the mouse device handles.
-
-Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to bind driver to.
- RemainingDevicePath - Not used.
-
-Returns:
- EFI_SUCCESS - This driver is added to DeviceHandle.
- other - Errors occurred.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS EmptyStatus;
- EFI_ISA_IO_PROTOCOL *IsaIo;
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
- UINT8 Data;
- EFI_TPL OldTpl;
- EFI_STATUS_CODE_VALUE StatusCode;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- StatusCode = 0;
- MouseAbsolutePointerDev = NULL;
- IsaIo = NULL;
-
- //
- // Open the device path protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Report that the keyboard is being enabled
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE,
- ParentDevicePath
- );
-
- //
- // Get the ISA I/O Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiIsaIoProtocolGuid,
- (VOID **) &IsaIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_INVALID_PARAMETER;
- }
- //
- // Raise TPL to avoid keyboard operation impact
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // Allocate private data
- //
- MouseAbsolutePointerDev = AllocateZeroPool (sizeof (PS2_MOUSE_ABSOLUTE_POINTER_DEV));
- if (MouseAbsolutePointerDev == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
- //
- // Setup the device instance
- //
- MouseAbsolutePointerDev->Signature = PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE;
- MouseAbsolutePointerDev->Handle = Controller;
- MouseAbsolutePointerDev->SampleRate = SSR_20;
- MouseAbsolutePointerDev->Resolution = CMR4;
- MouseAbsolutePointerDev->Scaling = SF1;
- MouseAbsolutePointerDev->DataPackageSize = 3;
- MouseAbsolutePointerDev->IsaIo = IsaIo;
- MouseAbsolutePointerDev->DevicePath = ParentDevicePath;
-
- //
- // Resolution = 4 counts/mm
- //
- MouseAbsolutePointerDev->Mode.AbsoluteMaxX = 1024;
- MouseAbsolutePointerDev->Mode.AbsoluteMinX = 0;
- MouseAbsolutePointerDev->Mode.AbsoluteMaxY = 798;
- MouseAbsolutePointerDev->Mode.AbsoluteMinY = 0;
- MouseAbsolutePointerDev->Mode.AbsoluteMaxZ = 0;
- MouseAbsolutePointerDev->Mode.AbsoluteMinZ = 0;
- MouseAbsolutePointerDev->Mode.Attributes = 0x03;
-
- MouseAbsolutePointerDev->AbsolutePointerProtocol.Reset = MouseAbsolutePointerReset;
- MouseAbsolutePointerDev->AbsolutePointerProtocol.GetState = MouseAbsolutePointerGetState;
- MouseAbsolutePointerDev->AbsolutePointerProtocol.Mode = &(MouseAbsolutePointerDev->Mode);
-
- //
- // Initialize keyboard controller if necessary
- //
- IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
- if ((Data & KBC_SYSF) != KBC_SYSF) {
- Status = KbcSelfTest (IsaIo);
- if (EFI_ERROR (Status)) {
- StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR;
- goto ErrorExit;
- }
- }
-
- KbcEnableAux (IsaIo);
-
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT,
- ParentDevicePath
- );
-
- //
- // Reset the mouse
- //
- Status = MouseAbsolutePointerDev->AbsolutePointerProtocol.Reset (&MouseAbsolutePointerDev->AbsolutePointerProtocol, TRUE);
- if (EFI_ERROR (Status)) {
- //
- // mouse not connected
- //
- Status = EFI_SUCCESS;
- StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
- goto ErrorExit;
- }
- //
- // Setup the WaitForKey event
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- MouseAbsolutePointerWaitForInput,
- MouseAbsolutePointerDev,
- &((MouseAbsolutePointerDev->AbsolutePointerProtocol).WaitForInput)
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
- //
- // Setup a periodic timer, used to poll mouse state
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- PollMouseAbsolutePointer,
- MouseAbsolutePointerDev,
- &MouseAbsolutePointerDev->TimerEvent
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
- //
- // Start timer to poll mouse (100 samples per second)
- //
- Status = gBS->SetTimer (MouseAbsolutePointerDev->TimerEvent, TimerPeriodic, 100000);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- MouseAbsolutePointerDev->ControllerNameTable = NULL;
- AddUnicodeString2 (
- "eng",
- gPs2MouseAbsolutePointerComponentName.SupportedLanguages,
- &MouseAbsolutePointerDev->ControllerNameTable,
- L"Faked PS/2 Touchpad Device",
- TRUE
- );
- AddUnicodeString2 (
- "en",
- gPs2MouseAbsolutePointerComponentName2.SupportedLanguages,
- &MouseAbsolutePointerDev->ControllerNameTable,
- L"Faked PS/2 Touchpad Device",
- FALSE
- );
-
-
- //
- // Install protocol interfaces for the mouse device.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiAbsolutePointerProtocolGuid,
- &MouseAbsolutePointerDev->AbsolutePointerProtocol,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-
-ErrorExit:
-
- KbcDisableAux (IsaIo);
-
- if (StatusCode != 0) {
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- StatusCode,
- ParentDevicePath
- );
- }
-
- if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput != NULL)) {
- gBS->CloseEvent (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput);
- }
-
- if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->TimerEvent != NULL)) {
- gBS->CloseEvent (MouseAbsolutePointerDev->TimerEvent);
- }
-
- if ((MouseAbsolutePointerDev != NULL) && (MouseAbsolutePointerDev->ControllerNameTable != NULL)) {
- FreeUnicodeStringTable (MouseAbsolutePointerDev->ControllerNameTable);
- }
- //
- // Since there will be no timer handler for mouse input any more,
- // exhaust input data just in case there is still mouse data left
- //
- EmptyStatus = EFI_SUCCESS;
- while (!EFI_ERROR (EmptyStatus)) {
- EmptyStatus = In8042Data (IsaIo, &Data);
- }
-
- if (MouseAbsolutePointerDev != NULL) {
- gBS->FreePool (MouseAbsolutePointerDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiIsaIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// GC_TODO: This - add argument and description to function comment
-// GC_TODO: Controller - add argument and description to function comment
-// GC_TODO: NumberOfChildren - add argument and description to function comment
-// GC_TODO: ChildHandleBuffer - add argument and description to function comment
-// GC_TODO: EFI_SUCCESS - add return value to function comment
-// GC_TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
- UINT8 Data;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiAbsolutePointerProtocolGuid,
- (VOID **) &AbsolutePointerProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
-
- MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (AbsolutePointerProtocol);
-
- //
- // Report that the keyboard is being disabled
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE,
- MouseAbsolutePointerDev->DevicePath
- );
-
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiAbsolutePointerProtocolGuid,
- &MouseAbsolutePointerDev->AbsolutePointerProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Disable mouse on keyboard controller
- //
- KbcDisableAux (MouseAbsolutePointerDev->IsaIo);
-
- //
- // Cancel mouse data polling timer, close timer event
- //
- gBS->SetTimer (MouseAbsolutePointerDev->TimerEvent, TimerCancel, 0);
- gBS->CloseEvent (MouseAbsolutePointerDev->TimerEvent);
-
- //
- // Since there will be no timer handler for mouse input any more,
- // exhaust input data just in case there is still mouse data left
- //
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Status = In8042Data (MouseAbsolutePointerDev->IsaIo, &Data);
- }
-
- gBS->CloseEvent (MouseAbsolutePointerDev->AbsolutePointerProtocol.WaitForInput);
- FreeUnicodeStringTable (MouseAbsolutePointerDev->ControllerNameTable);
- gBS->FreePool (MouseAbsolutePointerDev);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiIsaIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-MouseAbsolutePointerReset (
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system
-
-Arguments:
-
- This - Pointer of simple pointer Protocol.
- ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip.
-
-Returns:
-
- EFI_SUCCESS - The command byte is written successfully.
- EFI_DEVICE_ERROR - Errors occurred during reseting keyboard.
-
---*/
-{
- EFI_STATUS Status;
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
- EFI_TPL OldTpl;
- BOOLEAN KeyboardEnable;
- UINT8 Data;
-
- MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (This);
-
- //
- // Report reset progress code
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET,
- MouseAbsolutePointerDev->DevicePath
- );
-
- KeyboardEnable = FALSE;
-
- //
- // Raise TPL to avoid keyboard operation impact
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- ZeroMem (&MouseAbsolutePointerDev->State, sizeof (EFI_ABSOLUTE_POINTER_STATE));
- MouseAbsolutePointerDev->StateChanged = FALSE;
-
- //
- // Exhaust input data
- //
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Status = In8042Data (MouseAbsolutePointerDev->IsaIo, &Data);
- }
-
- CheckKbStatus (MouseAbsolutePointerDev->IsaIo, &KeyboardEnable);
-
- KbcDisableKb (MouseAbsolutePointerDev->IsaIo);
-
- MouseAbsolutePointerDev->IsaIo->Io.Read (MouseAbsolutePointerDev->IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
-
- //
- // if there's data block on KBC data port, read it out
- //
- if ((Data & KBC_OUTB) == KBC_OUTB) {
- MouseAbsolutePointerDev->IsaIo->Io.Read (MouseAbsolutePointerDev->IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Data);
- }
-
- Status = EFI_SUCCESS;
- //
- // The PS2 mouse driver reset behavior is always successfully return no matter wheater or not there is mouse connected to system.
- // This behavior is needed by performance speed. The following mouse command only succeessfully finish when mouse device is
- // connected to system, so if PS2 mouse device not connect to system or user not ask for, we skip the mouse configuration and enabling
- //
- if (ExtendedVerification && CheckMouseAbsolutePointerConnect (MouseAbsolutePointerDev)) {
- //
- // Send mouse reset command and set mouse default configure
- //
- Status = PS2MouseReset (MouseAbsolutePointerDev->IsaIo);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Exit;
- }
-
- Status = PS2MouseSetSampleRate (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->SampleRate);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Exit;
- }
-
- Status = PS2MouseSetResolution (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->Resolution);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Exit;
- }
-
- Status = PS2MouseSetScaling (MouseAbsolutePointerDev->IsaIo, MouseAbsolutePointerDev->Scaling);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Exit;
- }
-
- Status = PS2MouseEnable (MouseAbsolutePointerDev->IsaIo);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Exit;
- }
- }
-Exit:
- gBS->RestoreTPL (OldTpl);
-
- if (KeyboardEnable) {
- KbcEnableKb (MouseAbsolutePointerDev->IsaIo);
- }
-
- return Status;
-}
-
-BOOLEAN
-CheckMouseAbsolutePointerConnect (
- IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev
- )
-/*++
-
-Routine Description:
-
- Check whether there is Ps/2 mouse device in system
-
-Arguments:
-
- PS2_MOUSE_DEV - Mouse Private Data Structure
-
-Returns:
-
- TRUE - Keyboard in System.
- FALSE - Keyboard not in System.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = PS2MouseEnable (MouseAbsolutePointerDev->IsaIo);
- if (!EFI_ERROR (Status)) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-EFIAPI
-MouseAbsolutePointerGetState (
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- This - GC_TODO: add argument description
- State - GC_TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - GC_TODO: Add description for return value
- EFI_NOT_READY - GC_TODO: Add description for return value
- EFI_SUCCESS - GC_TODO: Add description for return value
-
---*/
-{
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
- EFI_TPL OldTpl;
-
- MouseAbsolutePointerDev = PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS (This);
-
- if (State == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!MouseAbsolutePointerDev->StateChanged) {
- return EFI_NOT_READY;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- CopyMem (State, &(MouseAbsolutePointerDev->State), sizeof (EFI_ABSOLUTE_POINTER_STATE));
-
- //
- // clear mouse state
- //
- MouseAbsolutePointerDev->State.CurrentX = 0;
- MouseAbsolutePointerDev->State.CurrentY = 0;
- MouseAbsolutePointerDev->State.CurrentZ = 0;
- MouseAbsolutePointerDev->State.ActiveButtons = 0x0;
- MouseAbsolutePointerDev->StateChanged = FALSE;
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-MouseAbsolutePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Event notification function for SIMPLE_POINTER.WaitForInput event
- Signal the event if there is input from mouse
-
-Arguments:
-
-Returns:
-
---*/
-// GC_TODO: Event - add argument and description to function comment
-// GC_TODO: Context - add argument and description to function comment
-{
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
-
- MouseAbsolutePointerDev = (PS2_MOUSE_ABSOLUTE_POINTER_DEV *) Context;
-
- //
- // Someone is waiting on the mouse event, if there's
- // input from mouse, signal the event
- //
- if (MouseAbsolutePointerDev->StateChanged) {
- gBS->SignalEvent (Event);
- }
-
-}
-
-VOID
-EFIAPI
-PollMouseAbsolutePointer(
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Event notification function for TimerEvent event
- If mouse device is connected to system, try to get the mouse packet data
-
-Arguments:
-
- Event - TimerEvent in PS2_MOUSE_DEV
- Context - Pointer to PS2_MOUSE_DEV structure
-
-Returns:
-
- None
-
---*/
-{
- PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;
-
- MouseAbsolutePointerDev = (PS2_MOUSE_ABSOLUTE_POINTER_DEV *) Context;
-
- //
- // Polling mouse packet data
- //
- PS2MouseGetPacket (MouseAbsolutePointerDev);
-}
-
-/**
- The user Entry Point for module Ps2MouseAbsolutePointer. The user code starts with this function.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializePs2MouseAbsolutePointer(
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install driver model protocol(s).
- //
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gPS2MouseAbsolutePointerDriver,
- ImageHandle,
- &gPs2MouseAbsolutePointerComponentName,
- &gPs2MouseAbsolutePointerComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
-
- return Status;
-}
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.h deleted file mode 100644 index 46cdff9db7..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointer.h +++ /dev/null @@ -1,301 +0,0 @@ -/**@file
- A Ps2MouseAbsolutePointer driver header file
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _PS2MOUSEABSOLUTEPOINTER_H
-#define _PS2MOUSEABSOLUTEPOINTER_H
-
-#include <PiDxe.h>
-#include <Framework/StatusCode.h>
-
-#include <Protocol/AbsolutePointer.h>
-#include <Protocol/IsaIo.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/ReportStatusCodeLib.h>
-
-//
-// PS/2 mouse sample rate
-//
-typedef enum {
- SSR_10,
- SSR_20,
- SSR_40,
- SSR_60,
- SSR_80,
- SSR_100,
- SSR_200,
- MAX_SR
-} MOUSE_SR;
-
-//
-// PS/2 mouse resolution
-//
-typedef enum {
- CMR1,
- CMR2,
- CMR4,
- CMR8,
- MAX_CMR
-} MOUSE_RE;
-
-//
-// PS/2 mouse scaling
-//
-typedef enum {
- SF1,
- SF2
-} MOUSE_SF;
-
-//
-// Driver Private Data
-//
-#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE EFI_SIGNATURE_32 ('p', '2', 's', 't')
-
-typedef struct {
- UINTN Signature;
-
- EFI_HANDLE Handle;
- EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol;
- EFI_ABSOLUTE_POINTER_STATE State;
- EFI_ABSOLUTE_POINTER_MODE Mode;
- BOOLEAN StateChanged;
-
- //
- // PS2 Mouse device specific information
- //
- MOUSE_SR SampleRate;
- MOUSE_RE Resolution;
- MOUSE_SF Scaling;
- UINT8 DataPackageSize;
-
- EFI_ISA_IO_PROTOCOL *IsaIo;
-
- EFI_EVENT TimerEvent;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} PS2_MOUSE_ABSOLUTE_POINTER_DEV;
-
-#define PS2_MOUSE_ABSOLUTE_POINTER_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_ABSOLUTE_POINTER_DEV, AbsolutePointerProtocol, PS2_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseAbsolutePointerDriver;
-extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseAbsolutePointerComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseAbsolutePointerComponentName2;
-
-//
-// Function prototypes
-//
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PS2MouseAbsolutePointerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 3066 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-Ps2MouseAbsolutePointerComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 3066 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-Ps2MouseAbsolutePointerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-
-EFI_STATUS
-EFIAPI
-MouseAbsolutePointerReset (
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-EFI_STATUS
-EFIAPI
-MouseAbsolutePointerGetState (
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State
- );
-
-VOID
-EFIAPI
-MouseAbsolutePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-PollMouseAbsolutePointer (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-In8042Data (
- IN EFI_ISA_IO_PROTOCOL *IsaIo,
- IN OUT UINT8 *Data
- );
-BOOLEAN
-CheckMouseAbsolutePointerConnect (
- IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev
- );
-
-#endif
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.inf b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.inf deleted file mode 100644 index 25c62c66d7..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.inf +++ /dev/null @@ -1,58 +0,0 @@ -#/** @file
-# Ps2 Mouse Simulate TouchPad Driver
-#
-# This dirver directly uses IsaIo protocol service to support a faked Ps2 TouchPad work.
-# Copyright (c) 2006 - 2007, Intel Corporation.
-#
-# Copyright (c) 2006 - 2007, Intel Corporation
-# All rights reserved. This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = Ps2MouseAbsolutePointerDxe
- FILE_GUID = 2899C94A-1FB6-4b1a-B96B-8364975303E0
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- EDK_RELEASE_VERSION = 0x00020000
- EFI_SPECIFICATION_VERSION = 0x00020000
-
- ENTRY_POINT = InitializePs2MouseAbsolutePointer
-
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-
-[Sources.common]
- ComponentName.c
- CommPs2.h
- CommPs2.c
- Ps2MouseAbsolutePointer.h
- Ps2MouseAbsolutePointer.c
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
-
-[LibraryClasses]
- ReportStatusCodeLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- DebugLib
-
-[Protocols]
- gEfiIsaIoProtocolGuid # PROTOCOL TO_START
- gEfiAbsolutePointerProtocolGuid # PROTOCOL BY_START
- gEfiDevicePathProtocolGuid # PROTOCOL TO_START
-
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.msa b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.msa deleted file mode 100644 index 7509b324b4..0000000000 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseAbsolutePointerDxe.msa +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<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">
- <MsaHeader>
- <ModuleName>Ps2MouseAbsolutePointer</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>2899C94A-1FB6-4b1a-B96B-8364975303E0</GuidValue>
- <Version>1.0</Version>
- <Abstract>Ps2 Mouse Absolute Pointer Driver</Abstract>
- <Description>This dirver directly uses IsaIo protocol service to support a faked Ps2 touchpad work.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Ps2MouseAbsolutePointer</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Ps2MouseAbsolutePointer.c</Filename>
- <Filename>Ps2MouseAbsolutePointer.h</Filename>
- <Filename>CommPs2.c</Filename>
- <Filename>CommPs2.h</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiAbsolutePointerProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiIsaIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Events>
- <CreateEvents>
- <EventTypes Usage="ALWAYS_PRODUCED">
- <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>
- <HelpText>Set up a time event to wait for the faked touchpad input</HelpText>
- </EventTypes>
- <EventTypes Usage="ALWAYS_PRODUCED">
- <EventType>EVENT_TYPE_PERIODIC_TIMER</EventType>
- <HelpText>Set up a periodic timer to poll the faked touchpad state at a fixed interval</HelpText>
- </EventTypes>
- </CreateEvents>
- <SignalEvents>
- <EventTypes Usage="SOMETIMES_PRODUCED">
- <EventType>EVENT_TYPE_RELATIVE_TIMER</EventType>
- <HelpText>Signal an event whenever these is a pending event from the faked touchpad input</HelpText>
- </EventTypes>
- </SignalEvents>
- </Events>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gPS2MouseAbsolutePointerDriver</DriverBinding>
- <ComponentName>gPs2MouseAbsolutePointerComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc index edf8642493..be6b88cd89 100644 --- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc +++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc @@ -183,7 +183,7 @@ IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf
- IntelFrameworkModulePkg/Bus/Isa/Ps2MouseSimulateTouchPadDxe/Ps2MouseSimulateTouchPadDxe.inf
+ IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointerDxe.inf
IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf
IntelFrameworkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.inf
|