/** @file\r
\r
+ Usb bus enumeration support.\r
+\r
Copyright (c) 2007 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- Module Name:\r
-\r
- UsbEnumer.c\r
-\r
- Abstract:\r
-\r
- Usb bus enumeration support\r
-\r
- Revision History\r
-\r
-\r
**/\r
\r
#include "UsbBus.h"\r
\r
\r
/**\r
- Return the endpoint descriptor in this interface\r
+ Return the endpoint descriptor in this interface.\r
\r
- @param UsbIf The interface to search in\r
- @param EpAddr The address of the endpoint to return\r
+ @param UsbIf The interface to search in.\r
+ @param EpAddr The address of the endpoint to return.\r
\r
- @return The endpoint descriptor or NULL\r
+ @return The endpoint descriptor or NULL.\r
\r
**/\r
USB_ENDPOINT_DESC *\r
\r
\r
/**\r
- Free the resource used by USB interface\r
+ Free the resource used by USB interface.\r
\r
- @param UsbIf The USB interface to free\r
+ @param UsbIf The USB interface to free.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbFreeInterface (\r
IN USB_INTERFACE *UsbIf\r
Create an interface for the descriptor IfDesc. Each\r
device's configuration can have several interfaces.\r
\r
- @param Device The device has the interface descriptor\r
- @param IfDesc The interface descriptor\r
+ @param Device The device has the interface descriptor.\r
+ @param IfDesc The interface descriptor.\r
\r
@return The created USB interface for the descriptor, or NULL.\r
\r
**/\r
-STATIC\r
USB_INTERFACE *\r
UsbCreateInterface (\r
IN USB_DEVICE *Device,\r
return UsbIf;\r
\r
ON_ERROR:\r
- if (UsbIf->DevicePath) {\r
+ if (UsbIf->DevicePath != NULL) {\r
gBS->FreePool (UsbIf->DevicePath);\r
}\r
\r
\r
\r
/**\r
- Free the resource used by this USB device\r
+ Free the resource used by this USB device.\r
\r
- @param Device The USB device to free\r
+ @param Device The USB device to free.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbFreeDevice (\r
IN USB_DEVICE *Device\r
/**\r
Create a device which is on the parent's ParentPort port.\r
\r
- @param ParentIf The parent HUB interface\r
- @param ParentPort The port on the HUB this device is connected to\r
+ @param ParentIf The parent HUB interface.\r
+ @param ParentPort The port on the HUB this device is connected to.\r
\r
- @return Created USB device\r
+ @return Created USB device, Or NULL.\r
\r
**/\r
-STATIC\r
USB_DEVICE *\r
UsbCreateDevice (\r
IN USB_INTERFACE *ParentIf,\r
Connect the USB interface with its driver. EFI USB bus will\r
create a USB interface for each seperate interface descriptor.\r
\r
- @param UsbIf The interface to connect driver to\r
+ @param UsbIf The interface to connect driver to.\r
\r
- @return EFI_SUCCESS : Interface is managed by some driver\r
- @return Others : Failed to locate a driver for this interface\r
+ @return EFI_SUCCESS Interface is managed by some driver.\r
+ @return Others Failed to locate a driver for this interface.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbConnectDriver (\r
IN USB_INTERFACE *UsbIf\r
settings. Only one setting is active. It will\r
also reset its endpoints' toggle to zero.\r
\r
- @param IfDesc The interface descriptor to set\r
- @param Alternate The alternate setting number to locate\r
+ @param IfDesc The interface descriptor to set.\r
+ @param Alternate The alternate setting number to locate.\r
\r
- @retval EFI_NOT_FOUND There is no setting with this alternate index\r
+ @retval EFI_NOT_FOUND There is no setting with this alternate index.\r
@retval EFI_SUCCESS The interface is set to Alternate setting.\r
\r
**/\r
Select a new configuration for the device. Each\r
device may support several configurations.\r
\r
- @param Device The device to select configuration\r
- @param ConfigValue The index of the configuration ( != 0)\r
+ @param Device The device to select configuration.\r
+ @param ConfigValue The index of the configuration ( != 0).\r
\r
- @retval EFI_NOT_FOUND There is no configuration with the index\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource\r
+ @retval EFI_NOT_FOUND There is no configuration with the index.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.\r
@retval EFI_SUCCESS The configuration is selected.\r
\r
**/\r
}\r
\r
\r
-\r
/**\r
Disconnect the USB interface with its driver.\r
\r
- @param UsbIf The interface to disconnect driver from\r
+ @param UsbIf The interface to disconnect driver from.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbDisconnectDriver (\r
IN USB_INTERFACE *UsbIf\r
}\r
\r
\r
-\r
/**\r
- Remove the current device configuration\r
+ Remove the current device configuration.\r
\r
- @param Device The USB device to remove configuration from\r
+ @param Device The USB device to remove configuration from.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
}\r
\r
\r
-\r
/**\r
Remove the device and all its children from the bus.\r
\r
- @param Device The device to remove\r
+ @param Device The device to remove.\r
\r
- @retval EFI_SUCCESS The device is removed\r
+ @retval EFI_SUCCESS The device is removed.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Find the child device on the hub's port\r
+ Find the child device on the hub's port.\r
\r
- @param HubIf The hub interface\r
- @param Port The port of the hub this child is connected to\r
+ @param HubIf The hub interface.\r
+ @param Port The port of the hub this child is connected to.\r
\r
- @return The device on the hub's port, or NULL if there is none\r
+ @return The device on the hub's port, or NULL if there is none.\r
\r
**/\r
-STATIC\r
USB_DEVICE *\r
UsbFindChild (\r
IN USB_INTERFACE *HubIf,\r
}\r
\r
\r
-\r
/**\r
Enumerate and configure the new device on the port of this HUB interface.\r
\r
- @param HubIf The HUB that has the device connected\r
- @param Port The port index of the hub (started with zero)\r
+ @param HubIf The HUB that has the device connected.\r
+ @param Port The port index of the hub (started with zero).\r
\r
- @retval EFI_SUCCESS The device is enumerated (added or removed)\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for the device\r
- @retval Others Failed to enumerate the device\r
+ @retval EFI_SUCCESS The device is enumerated (added or removed).\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for the device.\r
+ @retval Others Failed to enumerate the device.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbEnumerateNewDev (\r
IN USB_INTERFACE *HubIf,\r
}\r
\r
\r
-\r
/**\r
Process the events on the port.\r
\r
- @param HubIf The HUB that has the device connected\r
- @param Port The port index of the hub (started with zero)\r
+ @param HubIf The HUB that has the device connected.\r
+ @param Port The port index of the hub (started with zero).\r
\r
- @retval EFI_SUCCESS The device is enumerated (added or removed)\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for the device\r
- @retval Others Failed to enumerate the device\r
+ @retval EFI_SUCCESS The device is enumerated (added or removed).\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for the device.\r
+ @retval Others Failed to enumerate the device.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbEnumeratePort (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Enumerate all the changed hub ports\r
+ Enumerate all the changed hub ports.\r
\r
- @param Event The event that is triggered\r
- @param Context The context to the event\r
+ @param Event The event that is triggered.\r
+ @param Context The context to the event.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
+EFIAPI\r
UsbHubEnumeration (\r
IN EFI_EVENT Event,\r
IN VOID *Context\r
\r
\r
/**\r
- Enumerate all the changed hub ports\r
+ Enumerate all the changed hub ports.\r
\r
- @param Event The event that is triggered\r
- @param Context The context to the event\r
+ @param Event The event that is triggered.\r
+ @param Context The context to the event.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r