MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -9,9 +9,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "Ps2Mouse.h"
|
||||
#include "CommPs2.h"
|
||||
|
||||
UINT8 SampleRateTbl[MaxSampleRate] = { 0xa, 0x14, 0x28, 0x3c, 0x50, 0x64, 0xc8 };
|
||||
UINT8 SampleRateTbl[MaxSampleRate] = { 0xa, 0x14, 0x28, 0x3c, 0x50, 0x64, 0xc8 };
|
||||
|
||||
UINT8 ResolutionTbl[MaxResolution] = { 0, 1, 2, 3 };
|
||||
UINT8 ResolutionTbl[MaxResolution] = { 0, 1, 2, 3 };
|
||||
|
||||
/**
|
||||
Issue self test command via IsaIo interface.
|
||||
@@ -34,6 +34,7 @@ KbcSelfTest (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Read return code
|
||||
//
|
||||
@@ -45,6 +46,7 @@ KbcSelfTest (
|
||||
if (Data != 0x55) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Set system flag
|
||||
//
|
||||
@@ -63,7 +65,7 @@ KbcSelfTest (
|
||||
return Status;
|
||||
}
|
||||
|
||||
Data |= CMD_SYS_FLAG;
|
||||
Data |= CMD_SYS_FLAG;
|
||||
Status = Out8042Data (Data);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -149,7 +151,7 @@ KbcDisableKb (
|
||||
**/
|
||||
EFI_STATUS
|
||||
CheckKbStatus (
|
||||
OUT BOOLEAN *KeyboardEnable
|
||||
OUT BOOLEAN *KeyboardEnable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -167,6 +169,7 @@ CheckKbStatus (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check keyboard enable or not
|
||||
//
|
||||
@@ -201,6 +204,7 @@ PS2MouseReset (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check BAT Complete Code
|
||||
//
|
||||
@@ -212,6 +216,7 @@ PS2MouseReset (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check BAT Complete Code
|
||||
//
|
||||
@@ -231,7 +236,7 @@ PS2MouseReset (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetSampleRate (
|
||||
IN MOUSE_SR SampleRate
|
||||
IN MOUSE_SR SampleRate
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -258,7 +263,7 @@ PS2MouseSetSampleRate (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetResolution (
|
||||
IN MOUSE_RE Resolution
|
||||
IN MOUSE_RE Resolution
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -285,7 +290,7 @@ PS2MouseSetResolution (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetScaling (
|
||||
IN MOUSE_SF Scaling
|
||||
IN MOUSE_SF Scaling
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -321,7 +326,7 @@ PS2MouseEnable (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseGetPacket (
|
||||
PS2_MOUSE_DEV *MouseDev
|
||||
PS2_MOUSE_DEV *MouseDev
|
||||
)
|
||||
|
||||
{
|
||||
@@ -336,111 +341,112 @@ PS2MouseGetPacket (
|
||||
BOOLEAN LButton;
|
||||
BOOLEAN RButton;
|
||||
|
||||
KeyboardEnable = FALSE;
|
||||
State = PS2_READ_BYTE_ONE;
|
||||
KeyboardEnable = FALSE;
|
||||
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 ();
|
||||
Count = 1;
|
||||
Status = PS2MouseRead (&Data, &Count, State);
|
||||
if (EFI_ERROR (Status)) {
|
||||
KbcEnableAux ();
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
case PS2_READ_BYTE_ONE:
|
||||
//
|
||||
// Read mouse first byte data, if failed, immediately return
|
||||
//
|
||||
KbcDisableAux ();
|
||||
Count = 1;
|
||||
Status = PS2MouseRead (&Data, &Count, State);
|
||||
if (EFI_ERROR (Status)) {
|
||||
KbcEnableAux ();
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
if (Count != 1) {
|
||||
KbcEnableAux ();
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
if (Count != 1) {
|
||||
KbcEnableAux ();
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
if (IS_PS2_SYNC_BYTE (Data)) {
|
||||
Packet[0] = Data;
|
||||
State = PS2_READ_DATA_BYTE;
|
||||
if (IS_PS2_SYNC_BYTE (Data)) {
|
||||
Packet[0] = Data;
|
||||
State = PS2_READ_DATA_BYTE;
|
||||
|
||||
CheckKbStatus (&KeyboardEnable);
|
||||
KbcDisableKb ();
|
||||
KbcEnableAux ();
|
||||
}
|
||||
break;
|
||||
CheckKbStatus (&KeyboardEnable);
|
||||
KbcDisableKb ();
|
||||
KbcEnableAux ();
|
||||
}
|
||||
|
||||
case PS2_READ_DATA_BYTE:
|
||||
Count = 2;
|
||||
Status = PS2MouseRead ((Packet + 1), &Count, State);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
|
||||
case PS2_READ_DATA_BYTE:
|
||||
Count = 2;
|
||||
Status = PS2MouseRead ((Packet + 1), &Count, State);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (KeyboardEnable) {
|
||||
KbcEnableKb ();
|
||||
}
|
||||
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
if (Count != 2) {
|
||||
if (KeyboardEnable) {
|
||||
KbcEnableKb ();
|
||||
}
|
||||
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
State = PS2_PROCESS_PACKET;
|
||||
break;
|
||||
|
||||
case PS2_PROCESS_PACKET:
|
||||
if (KeyboardEnable) {
|
||||
KbcEnableKb ();
|
||||
}
|
||||
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
if (Count != 2) {
|
||||
if (KeyboardEnable) {
|
||||
KbcEnableKb ();
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
if ((Packet[0] & 0x20) != 0) {
|
||||
RelativeMovementY = (INT16)(RelativeMovementY | 0xFF00);
|
||||
}
|
||||
|
||||
State = PS2_PROCESS_PACKET;
|
||||
break;
|
||||
RButton = (UINT8)(Packet[0] & 0x2);
|
||||
LButton = (UINT8)(Packet[0] & 0x1);
|
||||
|
||||
case PS2_PROCESS_PACKET:
|
||||
if (KeyboardEnable) {
|
||||
KbcEnableKb ();
|
||||
}
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
//
|
||||
// Update mouse state
|
||||
//
|
||||
MouseDev->State.RelativeMovementX += RelativeMovementX;
|
||||
MouseDev->State.RelativeMovementY -= RelativeMovementY;
|
||||
MouseDev->State.RightButton = (UINT8)(RButton ? TRUE : FALSE);
|
||||
MouseDev->State.LeftButton = (UINT8)(LButton ? TRUE : FALSE);
|
||||
MouseDev->StateChanged = TRUE;
|
||||
|
||||
|
||||
RButton = (UINT8) (Packet[0] & 0x2);
|
||||
LButton = (UINT8) (Packet[0] & 0x1);
|
||||
|
||||
//
|
||||
// Update mouse state
|
||||
//
|
||||
MouseDev->State.RelativeMovementX += RelativeMovementX;
|
||||
MouseDev->State.RelativeMovementY -= RelativeMovementY;
|
||||
MouseDev->State.RightButton = (UINT8) (RButton ? TRUE : FALSE);
|
||||
MouseDev->State.LeftButton = (UINT8) (LButton ? TRUE : FALSE);
|
||||
MouseDev->StateChanged = TRUE;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,15 +462,15 @@ PS2MouseGetPacket (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN OUT UINTN *BufSize,
|
||||
IN UINTN State
|
||||
OUT UINT8 *Buffer,
|
||||
IN OUT UINTN *BufSize,
|
||||
IN UINTN State
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BytesRead;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
if (State == PS2_READ_BYTE_ONE) {
|
||||
//
|
||||
@@ -478,17 +484,18 @@ PS2MouseRead (
|
||||
}
|
||||
|
||||
for (BytesRead = 0; BytesRead < *BufSize; BytesRead++) {
|
||||
|
||||
Status = WaitOutputFull (TIMEOUT);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Buffer[BytesRead] = IoRead8 (KBC_DATA_PORT);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify the correct number of bytes read
|
||||
//
|
||||
if (BytesRead == 0 || BytesRead != *BufSize) {
|
||||
if ((BytesRead == 0) || (BytesRead != *BufSize)) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -499,6 +506,7 @@ PS2MouseRead (
|
||||
//
|
||||
// 8042 I/O function
|
||||
//
|
||||
|
||||
/**
|
||||
I/O work flow of outing 8042 command.
|
||||
|
||||
@@ -509,7 +517,7 @@ PS2MouseRead (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042Command (
|
||||
IN UINT8 Command
|
||||
IN UINT8 Command
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -521,6 +529,7 @@ Out8042Command (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Send command
|
||||
//
|
||||
@@ -544,10 +553,11 @@ Out8042Command (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042Data (
|
||||
IN UINT8 Data
|
||||
IN UINT8 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Wait keyboard controller input buffer empty
|
||||
//
|
||||
@@ -570,10 +580,10 @@ Out8042Data (
|
||||
**/
|
||||
EFI_STATUS
|
||||
In8042Data (
|
||||
IN OUT UINT8 *Data
|
||||
IN OUT UINT8 *Data
|
||||
)
|
||||
{
|
||||
UINTN Delay;
|
||||
UINTN Delay;
|
||||
|
||||
Delay = TIMEOUT / 50;
|
||||
|
||||
@@ -609,8 +619,8 @@ In8042Data (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042AuxCommand (
|
||||
IN UINT8 Command,
|
||||
IN BOOLEAN Resend
|
||||
IN UINT8 Command,
|
||||
IN BOOLEAN Resend
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -623,6 +633,7 @@ Out8042AuxCommand (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Send write to auxiliary device command
|
||||
//
|
||||
@@ -632,6 +643,7 @@ Out8042AuxCommand (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Send auxiliary device command
|
||||
//
|
||||
@@ -650,13 +662,11 @@ Out8042AuxCommand (
|
||||
// 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
|
||||
@@ -665,13 +675,11 @@ Out8042AuxCommand (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// Invalid return code
|
||||
//
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -687,10 +695,11 @@ Out8042AuxCommand (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042AuxData (
|
||||
IN UINT8 Data
|
||||
IN UINT8 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Wait keyboard controller input buffer empty
|
||||
//
|
||||
@@ -698,6 +707,7 @@ Out8042AuxData (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Send write to auxiliary device command
|
||||
//
|
||||
@@ -728,7 +738,7 @@ Out8042AuxData (
|
||||
**/
|
||||
EFI_STATUS
|
||||
In8042AuxData (
|
||||
IN OUT UINT8 *Data
|
||||
IN OUT UINT8 *Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -746,7 +756,6 @@ In8042AuxData (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check keyboard controller status, if it is output buffer full and for auxiliary device.
|
||||
|
||||
@@ -758,7 +767,7 @@ CheckForInput (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT8 Data;
|
||||
UINT8 Data;
|
||||
|
||||
Data = IoRead8 (KBC_CMD_STS_PORT);
|
||||
|
||||
@@ -782,11 +791,11 @@ CheckForInput (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WaitInputEmpty (
|
||||
IN UINTN Timeout
|
||||
IN UINTN Timeout
|
||||
)
|
||||
{
|
||||
UINTN Delay;
|
||||
UINT8 Data;
|
||||
UINTN Delay;
|
||||
UINT8 Data;
|
||||
|
||||
Delay = Timeout / 50;
|
||||
|
||||
@@ -821,11 +830,11 @@ WaitInputEmpty (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WaitOutputFull (
|
||||
IN UINTN Timeout
|
||||
IN UINTN Timeout
|
||||
)
|
||||
{
|
||||
UINTN Delay;
|
||||
UINT8 Data;
|
||||
UINTN Delay;
|
||||
UINT8 Data;
|
||||
|
||||
Delay = Timeout / 50;
|
||||
|
||||
|
@@ -11,18 +11,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "Ps2Mouse.h"
|
||||
|
||||
#define PS2_PACKET_LENGTH 3
|
||||
#define PS2_SYNC_MASK 0xc
|
||||
#define PS2_SYNC_BYTE 0x8
|
||||
#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 PS2_READ_BYTE_ONE 0
|
||||
#define PS2_READ_DATA_BYTE 1
|
||||
#define PS2_PROCESS_PACKET 2
|
||||
|
||||
#define TIMEOUT 50000
|
||||
#define BAT_TIMEOUT 500000
|
||||
#define TIMEOUT 50000
|
||||
#define BAT_TIMEOUT 500000
|
||||
|
||||
//
|
||||
// 8042 I/O Port
|
||||
@@ -42,31 +42,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
#define PS2_ACK 0xfa
|
||||
#define PS2_RESEND 0xfe
|
||||
#define PS2MOUSE_BAT1 0xaa
|
||||
#define PS2MOUSE_BAT2 0x0
|
||||
|
||||
//
|
||||
// Keyboard Controller Status
|
||||
@@ -78,7 +78,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
///
|
||||
/// General Time Out
|
||||
///
|
||||
#define KBC_TIM 0x40
|
||||
#define KBC_TIM 0x40
|
||||
///
|
||||
/// Output buffer for auxiliary device (PS/2):
|
||||
/// 0 - Holds keyboard data
|
||||
@@ -176,7 +176,7 @@ KbcDisableKb (
|
||||
**/
|
||||
EFI_STATUS
|
||||
CheckKbStatus (
|
||||
OUT BOOLEAN *KeyboardEnable
|
||||
OUT BOOLEAN *KeyboardEnable
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ PS2MouseReset (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetSampleRate (
|
||||
IN MOUSE_SR SampleRate
|
||||
IN MOUSE_SR SampleRate
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -210,7 +210,7 @@ PS2MouseSetSampleRate (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetResolution (
|
||||
IN MOUSE_RE Resolution
|
||||
IN MOUSE_RE Resolution
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -222,7 +222,7 @@ PS2MouseSetResolution (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseSetScaling (
|
||||
IN MOUSE_SF Scaling
|
||||
IN MOUSE_SF Scaling
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -246,7 +246,7 @@ PS2MouseEnable (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseGetPacket (
|
||||
PS2_MOUSE_DEV *MouseDev
|
||||
PS2_MOUSE_DEV *MouseDev
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -260,14 +260,15 @@ PS2MouseGetPacket (
|
||||
**/
|
||||
EFI_STATUS
|
||||
PS2MouseRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN OUT UINTN *BufSize,
|
||||
IN UINTN State
|
||||
OUT UINT8 *Buffer,
|
||||
IN OUT UINTN *BufSize,
|
||||
IN UINTN State
|
||||
);
|
||||
|
||||
//
|
||||
// 8042 I/O function
|
||||
//
|
||||
|
||||
/**
|
||||
I/O work flow of outing 8042 command.
|
||||
|
||||
@@ -278,7 +279,7 @@ PS2MouseRead (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042Command (
|
||||
IN UINT8 Command
|
||||
IN UINT8 Command
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -291,7 +292,7 @@ Out8042Command (
|
||||
**/
|
||||
EFI_STATUS
|
||||
In8042Data (
|
||||
IN OUT UINT8 *Data
|
||||
IN OUT UINT8 *Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -304,7 +305,7 @@ In8042Data (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042Data (
|
||||
IN UINT8 Data
|
||||
IN UINT8 Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -318,8 +319,8 @@ Out8042Data (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042AuxCommand (
|
||||
IN UINT8 Command,
|
||||
IN BOOLEAN Resend
|
||||
IN UINT8 Command,
|
||||
IN BOOLEAN Resend
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -332,7 +333,7 @@ Out8042AuxCommand (
|
||||
**/
|
||||
EFI_STATUS
|
||||
In8042AuxData (
|
||||
IN OUT UINT8 *Data
|
||||
IN OUT UINT8 *Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -345,7 +346,7 @@ In8042AuxData (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Out8042AuxData (
|
||||
IN UINT8 Data
|
||||
IN UINT8 Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -369,7 +370,7 @@ CheckForInput (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WaitInputEmpty (
|
||||
IN UINTN Timeout
|
||||
IN UINTN Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -382,8 +383,7 @@ WaitInputEmpty (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WaitOutputFull (
|
||||
IN UINTN Timeout
|
||||
IN UINTN Timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -20,14 +20,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentNam
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)Ps2MouseComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)Ps2MouseComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"PS/2 Mouse Driver"
|
||||
@@ -165,16 +164,16 @@ Ps2MouseComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ps2MouseComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
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_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
@@ -182,6 +181,7 @@ Ps2MouseComponentNameGetControllerName (
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Controller's handle
|
||||
//
|
||||
@@ -190,13 +190,14 @@ Ps2MouseComponentNameGetControllerName (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the device context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
(VOID **) &SimplePointerProtocol,
|
||||
(VOID **)&SimplePointerProtocol,
|
||||
gPS2MouseDriver.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
|
@@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
///
|
||||
/// DriverBinding Protocol Instance
|
||||
///
|
||||
EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver = {
|
||||
PS2MouseDriverSupported,
|
||||
PS2MouseDriverStart,
|
||||
PS2MouseDriverStop,
|
||||
@@ -39,15 +39,15 @@ EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver = {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SIO_PROTOCOL *Sio;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
EFI_STATUS Status;
|
||||
EFI_SIO_PROTOCOL *Sio;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
|
||||
//
|
||||
// Check whether the controller is keyboard.
|
||||
@@ -55,7 +55,7 @@ PS2MouseDriverSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
(VOID **)&DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -65,37 +65,38 @@ PS2MouseDriverSupported (
|
||||
}
|
||||
|
||||
do {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *)DevicePath;
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
} while (!IsDevicePathEnd (DevicePath));
|
||||
|
||||
if (DevicePathType (Acpi) != ACPI_DEVICE_PATH ||
|
||||
(DevicePathSubType (Acpi) != ACPI_DP && DevicePathSubType (Acpi) != ACPI_EXTENDED_DP)) {
|
||||
if ((DevicePathType (Acpi) != ACPI_DEVICE_PATH) ||
|
||||
((DevicePathSubType (Acpi) != ACPI_DP) && (DevicePathSubType (Acpi) != ACPI_EXTENDED_DP)))
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
switch (Acpi->HID) {
|
||||
case EISA_PNP_ID (0xF03):
|
||||
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 (Acpi->UID == 1) {
|
||||
case EISA_PNP_ID (0xF13):
|
||||
//
|
||||
// PS/2 Port for PS/2-style Mice
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
break;
|
||||
case EISA_PNP_ID (0x303):
|
||||
//
|
||||
// IBM Enhanced (101/102-key, PS/2 mouse support)
|
||||
//
|
||||
if (Acpi->UID == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -104,7 +105,7 @@ PS2MouseDriverSupported (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiSioProtocolGuid,
|
||||
(VOID **) &Sio,
|
||||
(VOID **)&Sio,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@@ -143,21 +144,21 @@ PS2MouseDriverSupported (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS EmptyStatus;
|
||||
EFI_SIO_PROTOCOL *Sio;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
UINT8 Data;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS_CODE_VALUE StatusCode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS EmptyStatus;
|
||||
EFI_SIO_PROTOCOL *Sio;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
UINT8 Data;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS_CODE_VALUE StatusCode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
StatusCode = 0;
|
||||
StatusCode = 0;
|
||||
|
||||
//
|
||||
// Open the device path protocol
|
||||
@@ -165,7 +166,7 @@ PS2MouseDriverStart (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
(VOID **)&DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -173,6 +174,7 @@ PS2MouseDriverStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Report that the keyboard is being enabled
|
||||
//
|
||||
@@ -188,7 +190,7 @@ PS2MouseDriverStart (
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiSioProtocolGuid,
|
||||
(VOID **) &Sio,
|
||||
(VOID **)&Sio,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
@@ -196,6 +198,7 @@ PS2MouseDriverStart (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Raise TPL to avoid keyboard operation impact
|
||||
//
|
||||
@@ -209,6 +212,7 @@ PS2MouseDriverStart (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
//
|
||||
// Setup the device instance
|
||||
//
|
||||
@@ -223,14 +227,14 @@ PS2MouseDriverStart (
|
||||
//
|
||||
// Resolution = 4 counts/mm
|
||||
//
|
||||
MouseDev->Mode.ResolutionX = 4;
|
||||
MouseDev->Mode.ResolutionY = 4;
|
||||
MouseDev->Mode.LeftButton = TRUE;
|
||||
MouseDev->Mode.RightButton = TRUE;
|
||||
MouseDev->Mode.ResolutionX = 4;
|
||||
MouseDev->Mode.ResolutionY = 4;
|
||||
MouseDev->Mode.LeftButton = TRUE;
|
||||
MouseDev->Mode.RightButton = TRUE;
|
||||
|
||||
MouseDev->SimplePointerProtocol.Reset = MouseReset;
|
||||
MouseDev->SimplePointerProtocol.GetState = MouseGetState;
|
||||
MouseDev->SimplePointerProtocol.Mode = &(MouseDev->Mode);
|
||||
MouseDev->SimplePointerProtocol.Reset = MouseReset;
|
||||
MouseDev->SimplePointerProtocol.GetState = MouseGetState;
|
||||
MouseDev->SimplePointerProtocol.Mode = &(MouseDev->Mode);
|
||||
|
||||
//
|
||||
// Initialize keyboard controller if necessary
|
||||
@@ -275,15 +279,15 @@ PS2MouseDriverStart (
|
||||
// Reset the mouse
|
||||
//
|
||||
Status = MouseDev->SimplePointerProtocol.Reset (
|
||||
&MouseDev->SimplePointerProtocol,
|
||||
FeaturePcdGet (PcdPs2MouseExtendedVerification)
|
||||
);
|
||||
&MouseDev->SimplePointerProtocol,
|
||||
FeaturePcdGet (PcdPs2MouseExtendedVerification)
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// mouse not connected
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
|
||||
Status = EFI_SUCCESS;
|
||||
StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
@@ -307,6 +311,7 @@ PS2MouseDriverStart (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
//
|
||||
// Setup a periodic timer, used to poll mouse state
|
||||
//
|
||||
@@ -321,6 +326,7 @@ PS2MouseDriverStart (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
//
|
||||
// Start timer to poll mouse (100 samples per second)
|
||||
//
|
||||
@@ -346,7 +352,6 @@ PS2MouseDriverStart (
|
||||
FALSE
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Install protocol interfaces for the mouse device.
|
||||
//
|
||||
@@ -441,21 +446,21 @@ ErrorExit:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
UINT8 Data;
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
UINT8 Data;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
(VOID **) &SimplePointerProtocol,
|
||||
(VOID **)&SimplePointerProtocol,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -535,15 +540,15 @@ PS2MouseDriverStop (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MouseReset (
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
EFI_TPL OldTpl;
|
||||
BOOLEAN KeyboardEnable;
|
||||
UINT8 Data;
|
||||
EFI_STATUS Status;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
EFI_TPL OldTpl;
|
||||
BOOLEAN KeyboardEnable;
|
||||
UINT8 Data;
|
||||
|
||||
MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
|
||||
|
||||
@@ -625,6 +630,7 @@ MouseReset (
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
@@ -646,11 +652,11 @@ Exit:
|
||||
**/
|
||||
BOOLEAN
|
||||
CheckMouseConnect (
|
||||
IN PS2_MOUSE_DEV *MouseDev
|
||||
IN PS2_MOUSE_DEV *MouseDev
|
||||
)
|
||||
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = PS2MouseEnable ();
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -673,12 +679,12 @@ CheckMouseConnect (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MouseGetState (
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN OUT EFI_SIMPLE_POINTER_STATE *State
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN OUT EFI_SIMPLE_POINTER_STATE *State
|
||||
)
|
||||
{
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
EFI_TPL OldTpl;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
MouseDev = PS2_MOUSE_DEV_FROM_THIS (This);
|
||||
|
||||
@@ -717,13 +723,13 @@ MouseGetState (
|
||||
VOID
|
||||
EFIAPI
|
||||
MouseWaitForInput (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
|
||||
MouseDev = (PS2_MOUSE_DEV *) Context;
|
||||
MouseDev = (PS2_MOUSE_DEV *)Context;
|
||||
|
||||
//
|
||||
// Someone is waiting on the mouse event, if there's
|
||||
@@ -732,7 +738,6 @@ MouseWaitForInput (
|
||||
if (MouseDev->StateChanged) {
|
||||
gBS->SignalEvent (Event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,9 +756,9 @@ PollMouse (
|
||||
)
|
||||
|
||||
{
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
PS2_MOUSE_DEV *MouseDev;
|
||||
|
||||
MouseDev = (PS2_MOUSE_DEV *) Context;
|
||||
MouseDev = (PS2_MOUSE_DEV *)Context;
|
||||
|
||||
//
|
||||
// Polling mouse packet data
|
||||
@@ -773,12 +778,12 @@ PollMouse (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializePs2Mouse(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
InitializePs2Mouse (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Install driver model protocol(s).
|
||||
@@ -793,7 +798,5 @@ InitializePs2Mouse(
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -69,29 +69,29 @@ typedef enum {
|
||||
//
|
||||
// Driver Private Data
|
||||
//
|
||||
#define PS2_MOUSE_DEV_SIGNATURE SIGNATURE_32 ('p', 's', '2', 'm')
|
||||
#define PS2_MOUSE_DEV_SIGNATURE SIGNATURE_32 ('p', 's', '2', 'm')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;
|
||||
EFI_SIMPLE_POINTER_STATE State;
|
||||
EFI_SIMPLE_POINTER_MODE Mode;
|
||||
BOOLEAN StateChanged;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;
|
||||
EFI_SIMPLE_POINTER_STATE State;
|
||||
EFI_SIMPLE_POINTER_MODE Mode;
|
||||
BOOLEAN StateChanged;
|
||||
|
||||
//
|
||||
// PS2 Mouse device specific information
|
||||
//
|
||||
MOUSE_SR SampleRate;
|
||||
MOUSE_RE Resolution;
|
||||
MOUSE_SF Scaling;
|
||||
UINT8 DataPackageSize;
|
||||
MOUSE_SR SampleRate;
|
||||
MOUSE_RE Resolution;
|
||||
MOUSE_SF Scaling;
|
||||
UINT8 DataPackageSize;
|
||||
|
||||
EFI_EVENT TimerEvent;
|
||||
EFI_EVENT TimerEvent;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
} PS2_MOUSE_DEV;
|
||||
|
||||
#define PS2_MOUSE_DEV_FROM_THIS(a) CR (a, PS2_MOUSE_DEV, SimplePointerProtocol, PS2_MOUSE_DEV_SIGNATURE)
|
||||
@@ -99,6 +99,7 @@ typedef struct {
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle. Any ControllerHandle
|
||||
than contains a IsaIo protocol can be supported.
|
||||
@@ -116,9 +117,9 @@ typedef struct {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -139,9 +140,9 @@ PS2MouseDriverSupported (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -161,15 +162,16 @@ PS2MouseDriverStart (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PS2MouseDriverStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
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.
|
||||
|
||||
@@ -217,7 +219,6 @@ Ps2MouseComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -289,11 +290,11 @@ Ps2MouseComponentNameGetDriverName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ps2MouseComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -311,8 +312,8 @@ Ps2MouseComponentNameGetControllerName (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MouseReset (
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -328,8 +329,8 @@ MouseReset (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MouseGetState (
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN OUT EFI_SIMPLE_POINTER_STATE *State
|
||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||
IN OUT EFI_SIMPLE_POINTER_STATE *State
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -344,8 +345,8 @@ MouseGetState (
|
||||
VOID
|
||||
EFIAPI
|
||||
MouseWaitForInput (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -373,7 +374,7 @@ PollMouse (
|
||||
**/
|
||||
EFI_STATUS
|
||||
In8042Data (
|
||||
IN OUT UINT8 *Data
|
||||
IN OUT UINT8 *Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -387,7 +388,7 @@ In8042Data (
|
||||
**/
|
||||
BOOLEAN
|
||||
CheckMouseConnect (
|
||||
IN PS2_MOUSE_DEV *MouseDev
|
||||
IN PS2_MOUSE_DEV *MouseDev
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user