mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
Minor refinement for USB modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7257 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
55a64ae0f4
commit
c92e277d99
@ -120,7 +120,7 @@ USBKeyboardDriverBindingSupported (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts the device with this driver.
|
Starts the keyboard device with this driver.
|
||||||
|
|
||||||
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
|
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
|
||||||
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
|
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
|
||||||
@ -219,7 +219,7 @@ USBKeyboardDriverBindingStart (
|
|||||||
EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;
|
EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Traverse endpoints to find interrupt endpoints
|
// Traverse endpoints to find interrupt endpoint
|
||||||
//
|
//
|
||||||
Found = FALSE;
|
Found = FALSE;
|
||||||
for (Index = 0; Index < EndpointNumber; Index++) {
|
for (Index = 0; Index < EndpointNumber; Index++) {
|
||||||
@ -230,7 +230,7 @@ USBKeyboardDriverBindingStart (
|
|||||||
&EndpointDescriptor
|
&EndpointDescriptor
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((EndpointDescriptor.Attributes & 0x03) == USB_ENDPOINT_INTERRUPT) {
|
if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {
|
||||||
//
|
//
|
||||||
// We only care interrupt endpoint here
|
// We only care interrupt endpoint here
|
||||||
//
|
//
|
||||||
@ -392,7 +392,7 @@ ErrorExit:
|
|||||||
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
|
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
|
||||||
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
|
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
|
||||||
}
|
}
|
||||||
gBS->FreePool (UsbKeyboardDevice);
|
FreePool (UsbKeyboardDevice);
|
||||||
UsbKeyboardDevice = NULL;
|
UsbKeyboardDevice = NULL;
|
||||||
}
|
}
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
@ -515,7 +515,7 @@ USBKeyboardDriverBindingStop (
|
|||||||
FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);
|
FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (UsbKeyboardDevice);
|
FreePool (UsbKeyboardDevice);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ KbdFreeNotifyList (
|
|||||||
Link = GetFirstNode (NotifyList);
|
Link = GetFirstNode (NotifyList);
|
||||||
NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);
|
NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);
|
||||||
RemoveEntryList (Link);
|
RemoveEntryList (Link);
|
||||||
gBS->FreePool (NotifyNode);
|
FreePool (NotifyNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -1165,7 +1165,7 @@ USBKeyboardUnregisterKeyNotify (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (CurrentNotify);
|
FreePool (CurrentNotify);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ USBKeyboardDriverBindingSupported (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts the device with this driver.
|
Starts the keyboard device with this driver.
|
||||||
|
|
||||||
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
|
This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,
|
||||||
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
|
initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage
|
||||||
|
@ -413,7 +413,7 @@ GetCurrentKeyboardLayout (
|
|||||||
KeyboardLayout
|
KeyboardLayout
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
gBS->FreePool (KeyboardLayout);
|
FreePool (KeyboardLayout);
|
||||||
KeyboardLayout = NULL;
|
KeyboardLayout = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -814,7 +814,6 @@ InitUSBKeyboard (
|
|||||||
//
|
//
|
||||||
// Set boot protocol for the USB Keyboard.
|
// Set boot protocol for the USB Keyboard.
|
||||||
// This driver only supports boot protocol.
|
// This driver only supports boot protocol.
|
||||||
// The device that does not support boot protocol is not supported.
|
|
||||||
//
|
//
|
||||||
if (Protocol != BOOT_PROTOCOL) {
|
if (Protocol != BOOT_PROTOCOL) {
|
||||||
UsbSetProtocolRequest (
|
UsbSetProtocolRequest (
|
||||||
@ -871,14 +870,14 @@ InitUSBKeyboard (
|
|||||||
ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);
|
ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set a timer for repeat keys' generation.
|
// Create event for repeat keys' generation.
|
||||||
//
|
//
|
||||||
if (UsbKeyboardDevice->RepeatTimer != NULL) {
|
if (UsbKeyboardDevice->RepeatTimer != NULL) {
|
||||||
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
|
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
|
||||||
UsbKeyboardDevice->RepeatTimer = NULL;
|
UsbKeyboardDevice->RepeatTimer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
gBS->CreateEvent (
|
||||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
USBKeyboardRepeatHandler,
|
USBKeyboardRepeatHandler,
|
||||||
@ -886,12 +885,15 @@ InitUSBKeyboard (
|
|||||||
&UsbKeyboardDevice->RepeatTimer
|
&UsbKeyboardDevice->RepeatTimer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create event for delayed recovery, which deals with device error.
|
||||||
|
//
|
||||||
if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {
|
if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {
|
||||||
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
|
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
|
||||||
UsbKeyboardDevice->DelayedRecoveryEvent = NULL;
|
UsbKeyboardDevice->DelayedRecoveryEvent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
gBS->CreateEvent (
|
||||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
USBKeyboardRecoveryHandler,
|
USBKeyboardRecoveryHandler,
|
||||||
|
@ -121,13 +121,13 @@ UsbBotInit (
|
|||||||
if (Context != NULL) {
|
if (Context != NULL) {
|
||||||
*Context = UsbBot;
|
*Context = UsbBot;
|
||||||
} else {
|
} else {
|
||||||
gBS->FreePool (UsbBot);
|
FreePool (UsbBot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
ON_ERROR:
|
ON_ERROR:
|
||||||
gBS->FreePool (UsbBot);
|
FreePool (UsbBot);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ UsbBotCleanUp (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
gBS->FreePool (Context);
|
FreePool (Context);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,13 +146,13 @@ UsbCbiInit (
|
|||||||
if (Context != NULL) {
|
if (Context != NULL) {
|
||||||
*Context = UsbCbi;
|
*Context = UsbCbi;
|
||||||
} else {
|
} else {
|
||||||
gBS->FreePool (UsbCbi);
|
FreePool (UsbCbi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
ON_ERROR:
|
ON_ERROR:
|
||||||
gBS->FreePool (UsbCbi);
|
FreePool (UsbCbi);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,6 +605,6 @@ UsbCbiCleanUp (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
gBS->FreePool (Context);
|
FreePool (Context);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -854,7 +854,6 @@ UsbMouseReset (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Event notification function for SIMPLE_POINTER.WaitForInput event.
|
Event notification function for SIMPLE_POINTER.WaitForInput event.
|
||||||
|
|
||||||
@ -881,7 +880,6 @@ UsbMouseWaitForInput (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handler for Delayed Recovery event.
|
Handler for Delayed Recovery event.
|
||||||
|
|
||||||
|
@ -291,6 +291,63 @@ UsbMouseComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Functions of EFI_SIMPLE_POINTER_PROTOCOL
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the current state of a pointer device.
|
||||||
|
|
||||||
|
@param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.
|
||||||
|
@param MouseState A pointer to the state information on the pointer device.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The state of the pointer device was returned in State.
|
||||||
|
@retval EFI_NOT_READY The state of the pointer device has not changed since the last call to
|
||||||
|
GetState().
|
||||||
|
@retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's
|
||||||
|
current state.
|
||||||
|
@retval EFI_INVALID_PARAMETER MouseState is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetMouseState (
|
||||||
|
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||||
|
OUT EFI_SIMPLE_POINTER_STATE *MouseState
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets the pointer device hardware.
|
||||||
|
|
||||||
|
@param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.
|
||||||
|
@param ExtendedVerification Indicates that the driver may perform a more exhaustive
|
||||||
|
verification operation of the device during reset.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The device was reset.
|
||||||
|
@retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
UsbMouseReset (
|
||||||
|
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
||||||
|
IN BOOLEAN ExtendedVerification
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Event notification function for SIMPLE_POINTER.WaitForInput event.
|
||||||
|
|
||||||
|
@param Event Event to be signaled when there's input from mouse.
|
||||||
|
@param Context Points to USB_MOUSE_DEV instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
UsbMouseWaitForInput (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal worker functions
|
// Internal worker functions
|
||||||
//
|
//
|
||||||
@ -355,59 +412,6 @@ OnMouseInterruptComplete (
|
|||||||
IN UINT32 Result
|
IN UINT32 Result
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves the current state of a pointer device.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.
|
|
||||||
@param MouseState A pointer to the state information on the pointer device.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The state of the pointer device was returned in State.
|
|
||||||
@retval EFI_NOT_READY The state of the pointer device has not changed since the last call to
|
|
||||||
GetState().
|
|
||||||
@retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's
|
|
||||||
current state.
|
|
||||||
@retval EFI_INVALID_PARAMETER MouseState is NULL.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
GetMouseState (
|
|
||||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
|
||||||
OUT EFI_SIMPLE_POINTER_STATE *MouseState
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Resets the pointer device hardware.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.
|
|
||||||
@param ExtendedVerification Indicates that the driver may perform a more exhaustive
|
|
||||||
verification operation of the device during reset.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The device was reset.
|
|
||||||
@retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
UsbMouseReset (
|
|
||||||
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
|
|
||||||
IN BOOLEAN ExtendedVerification
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Event notification function for SIMPLE_POINTER.WaitForInput event.
|
|
||||||
|
|
||||||
@param Event Event to be signaled when there's input from mouse.
|
|
||||||
@param Context Points to USB_MOUSE_DEV instance.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
UsbMouseWaitForInput (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handler for Delayed Recovery event.
|
Handler for Delayed Recovery event.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user