From 18a73eb727e697f15891ccad55507ae3d8c37461 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Wed, 17 Jun 2009 01:57:42 +0000 Subject: [PATCH 1/1] clean ECC issue git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8580 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Isa/Ps2MouseAbsolutePointerDxe/CommPs2.c | 47 +++----- .../Isa/Ps2MouseAbsolutePointerDxe/CommPs2.h | 16 +-- .../ComponentName.c | 3 +- .../Ps2MouseAbsolutePointer.c | 19 ++-- .../Ps2MouseAbsolutePointer.h | 105 +++++++++++++++++- .../Bus/Isa/Ps2MouseDxe/Ps2Mouse.c | 4 +- .../Bus/Isa/Ps2MouseDxe/Ps2Mouse.h | 4 +- 7 files changed, 139 insertions(+), 59 deletions(-) diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.c index 60614fb9e1..b5d16792c4 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.c @@ -1,5 +1,5 @@ -/**@file - PS2 Mouse Communication Interface +/** @file + PS2 Mouse Communication Interface. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials @@ -341,7 +341,7 @@ PS2MouseEnable ( /** Get mouse packet . Only care first 3 bytes - @param MouseDev Pointer of PS2 Mouse Private Data Structure + @param MouseAbsolutePointerDev Pointer to PS2 Absolute Pointer Simulation Device Private Data Structure @retval EFI_NOT_READY Mouse Device not ready to input data packet, or some error happened during getting the packet @retval EFI_SUCCESS The data packet is gotten successfully. @@ -589,7 +589,7 @@ Out8042Data ( ) { EFI_STATUS Status; - UINT8 temp; + UINT8 Temp; // // Wait keyboard controller input buffer empty // @@ -598,8 +598,8 @@ Out8042Data ( return Status; } - temp = Data; - IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &temp); + Temp = Data; + IsaIo->Io.Write (IsaIo, EfiIsaIoWidthUint8, KBC_DATA_PORT, 1, &Temp); Status = WaitInputEmpty (IsaIo, TIMEOUT); if (EFI_ERROR (Status)) { @@ -625,23 +625,23 @@ In8042Data ( ) { UINTN Delay; - UINT8 temp; + UINT8 Temp; Delay = TIMEOUT / 50; do { - IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &temp); + 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) { + if ((Temp & KBC_OUTB) == KBC_OUTB) { break; } gBS->Stall (50); Delay--; - } while (Delay); + } while (Delay != 0); if (Delay == 0) { return EFI_TIMEOUT; @@ -738,9 +738,9 @@ Out8042AuxCommand ( I/O work flow of outing 8042 Aux data. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL - @param Command Aux I/O command + @param Data Buffer holding return value - @retval EFI_SUCCESS Success to excute I/O work flow + @retval EFI_SUCCESS Success to excute I/O work flow. @retval EFI_TIMEOUT Keyboard controller time out. **/ EFI_STATUS @@ -812,7 +812,7 @@ In8042AuxData ( /** - Check keyboard controller status, if it is output buffer full and for auxiliary device + Check keyboard controller status, if it is output buffer full and for auxiliary device. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL @@ -870,7 +870,7 @@ WaitInputEmpty ( gBS->Stall (50); Delay--; - } while (Delay); + } while (Delay != 0); if (Delay == 0) { return EFI_TIMEOUT; @@ -893,23 +893,6 @@ 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; @@ -929,7 +912,7 @@ Returns: gBS->Stall (50); Delay--; - } while (Delay); + } while (Delay != 0); if (Delay == 0) { return EFI_TIMEOUT; diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.h index fb2bbac750..294aaceb4f 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/CommPs2.h @@ -1,5 +1,5 @@ -/**@file - PS2 Mouse Communication Interface +/** @file + Using PS2 Mouse to simulation Absolution Pointer Device. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _COMMPS2_H_ -#define _COMMPS2_H_ +#ifndef __COMMPS2_H__ +#define __COMMPS2_H__ #define PS2_PACKET_LENGTH 3 #define PS2_SYNC_MASK 0xc @@ -246,7 +246,7 @@ PS2MouseEnable ( /** Get mouse packet . Only care first 3 bytes - @param MouseDev Pointer of PS2 Mouse Private Data Structure + @param MouseAbsolutePointerDev Pointer to PS2 Absolute Pointer Simulation Device Private Data Structure @retval EFI_NOT_READY Mouse Device not ready to input data packet, or some error happened during getting the packet @retval EFI_SUCCESS The data packet is gotten successfully. @@ -359,7 +359,7 @@ In8042AuxData ( I/O work flow of outing 8042 Aux data. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL - @param Command Aux I/O command + @param Data Buffer holding return value. @retval EFI_SUCCESS Success to excute I/O work flow @retval EFI_TIMEOUT Keyboard controller time out. @@ -371,7 +371,7 @@ Out8042AuxData ( ); /** - Check keyboard controller status, if it is output buffer full and for auxiliary device + Check keyboard controller status, if it is output buffer full and for auxiliary device. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL @@ -413,4 +413,4 @@ WaitOutputFull ( IN UINTN Timeout ); -#endif // _COMMPS2_H_ +#endif // __COMMPS2_H__ diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/ComponentName.c index 39505acfb8..5c0b038e6f 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/ComponentName.c @@ -1,4 +1,5 @@ -/**@file +/** @file + UEFI Component Name(2) protocol implementation for Ps2 Absolute Pointer Simulation Dxe driver. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.c index 55ebf95351..89f6d1d624 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.c @@ -1,5 +1,5 @@ -/**@file - A faked PS/2 Touchpad driver. Routines that interacts with callers, +/** @file + A faked PS/2 Absolute Pointer driver. Routines that interacts with callers, conforming to EFI driver model Copyright (c) 2006 - 2007, Intel Corporation @@ -486,7 +486,7 @@ PS2MouseAbsolutePointerDriverStop ( } /** - Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system + Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system. @param This - Pointer of simple pointer Protocol. @param ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip. @@ -604,7 +604,7 @@ Exit: /** Check whether there is Ps/2 mouse device in system - @param PS2_MOUSE_DEV - Mouse Private Data Structure + @param MouseAbsolutePointerDev - Absolute Pointer Device Private Data Structure @retval TRUE - Keyboard in System. @retval FALSE - Keyboard not in System. @@ -674,22 +674,19 @@ MouseAbsolutePointerGetState ( /** - Event notification function for SIMPLE_POINTER.WaitForInput event - Signal the event if there is input from mouse + Event notification function for SIMPLE_POINTER.WaitForInput event. + Signal the event if there is input from mouse. @param Event event object @param Context event context **/ - VOID EFIAPI MouseAbsolutePointerWaitForInput ( IN EFI_EVENT Event, IN VOID *Context ) -// 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; @@ -706,8 +703,8 @@ MouseAbsolutePointerWaitForInput ( } /** - Event notification function for TimerEvent event - If mouse device is connected to system, try to get the mouse packet data + Event notification function for TimerEvent event. + If mouse device is connected to system, try to get the mouse packet data. @param Event - TimerEvent in PS2_MOUSE_DEV @param Context - Pointer to PS2_MOUSE_DEV structure diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.h index e8266f8807..7a111f37f3 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointer.h @@ -1,4 +1,4 @@ -/**@file +/** @file A Ps2MouseAbsolutePointer driver header file Copyright (c) 2006 - 2007, Intel Corporation @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _PS2MOUSEABSOLUTEPOINTER_H -#define _PS2MOUSEABSOLUTEPOINTER_H +#ifndef __PS2MOUSEABSOLUTEPOINTER_H__ +#define __PS2MOUSEABSOLUTEPOINTER_H__ #include #include @@ -105,6 +105,20 @@ typedef struct { // // Function prototypes // +/** + Test to see if this driver supports ControllerHandle. Any ControllerHandle + than contains a IsaIo protocol can be supported. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI PS2MouseAbsolutePointerDriverSupported ( @@ -113,6 +127,21 @@ PS2MouseAbsolutePointerDriverSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); +/** + Start this driver on ControllerHandle by opening a IsaIo + protocol, creating PS2_MOUSE_ABSOLUTE_POINTER_DEV device and install gEfiAbsolutePointerProtocolGuid + finnally. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ EFI_STATUS EFIAPI PS2MouseAbsolutePointerDriverStart ( @@ -121,6 +150,20 @@ PS2MouseAbsolutePointerDriverStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); +/** + Stop this driver on ControllerHandle. Support stoping any child handles + created by this driver. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI PS2MouseAbsolutePointerDriverStop ( @@ -259,7 +302,17 @@ Ps2MouseAbsolutePointerComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); +/** + Reset the Mouse and do BAT test for it, if ExtendedVerification isTRUE and there is a mouse device connectted to system. + + @param This - Pointer of simple pointer Protocol. + @param ExtendedVerification - Whether configure mouse parameters. True: do; FALSE: skip. + + @retval EFI_SUCCESS - The command byte is written successfully. + @retval EFI_DEVICE_ERROR - Errors occurred during reseting keyboard. + +**/ EFI_STATUS EFIAPI MouseAbsolutePointerReset ( @@ -267,6 +320,16 @@ MouseAbsolutePointerReset ( IN BOOLEAN ExtendedVerification ); +/** + Get and Clear mouse status. + + @param This - Pointer of simple pointer Protocol. + @param State - Output buffer holding status. + + @retval EFI_INVALID_PARAMETER Output buffer is invalid. + @retval EFI_NOT_READY Mouse is not changed status yet. + @retval EFI_SUCCESS Mouse status is changed and get successful. +**/ EFI_STATUS EFIAPI MouseAbsolutePointerGetState ( @@ -274,6 +337,15 @@ MouseAbsolutePointerGetState ( IN OUT EFI_ABSOLUTE_POINTER_STATE *State ); +/** + + Event notification function for SIMPLE_POINTER.WaitForInput event. + Signal the event if there is input from mouse. + + @param Event event object + @param Context event context + +**/ VOID EFIAPI MouseAbsolutePointerWaitForInput ( @@ -281,6 +353,14 @@ MouseAbsolutePointerWaitForInput ( IN VOID *Context ); +/** + Event notification function for TimerEvent event. + If mouse device is connected to system, try to get the mouse packet data. + + @param Event - TimerEvent in PS2_MOUSE_DEV + @param Context - Pointer to PS2_MOUSE_DEV structure + +**/ VOID EFIAPI PollMouseAbsolutePointer ( @@ -288,11 +368,30 @@ PollMouseAbsolutePointer ( IN VOID *Context ); +/** + I/O work flow of in 8042 data. + + @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL + @param Data Data value + + @retval EFI_SUCCESS Success to excute I/O work flow + @retval EFI_TIMEOUT Keyboard controller time out. +**/ EFI_STATUS In8042Data ( IN EFI_ISA_IO_PROTOCOL *IsaIo, IN OUT UINT8 *Data ); + +/** + Check whether there is Ps/2 mouse device in system + + @param MouseAbsolutePointerDev - Absolute Pointer Device Private Data Structure + + @retval TRUE - Keyboard in System. + @retval FALSE - Keyboard not in System. + +**/ BOOLEAN CheckMouseAbsolutePointerConnect ( IN PS2_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c index b0dc3098bd..600f031ec1 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c @@ -716,8 +716,8 @@ MouseWaitForInput ( } /** - Event notification function for TimerEvent event - If mouse device is connected to system, try to get the mouse packet data + Event notification function for TimerEvent event. + If mouse device is connected to system, try to get the mouse packet data. @param Event - TimerEvent in PS2_MOUSE_DEV @param Context - Pointer to PS2_MOUSE_DEV structure diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h index ae6720a5c9..aadfd6aae9 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h @@ -354,8 +354,8 @@ MouseWaitForInput ( ); /** - Event notification function for TimerEvent event - If mouse device is connected to system, try to get the mouse packet data + Event notification function for TimerEvent event. + If mouse device is connected to system, try to get the mouse packet data. @param Event - TimerEvent in PS2_MOUSE_DEV @param Context - Pointer to PS2_MOUSE_DEV structure -- 2.39.2