TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbEnumer.c File Reference
#include "UsbBus.h"

Go to the source code of this file.

Functions

USB_ENDPOINT_DESCUsbGetEndpointDesc (IN USB_INTERFACE *UsbIf, IN UINT8 EpAddr)
 
EFI_STATUS UsbFreeInterface (IN USB_INTERFACE *UsbIf)
 
USB_INTERFACEUsbCreateInterface (IN USB_DEVICE *Device, IN USB_INTERFACE_DESC *IfDesc)
 
VOID UsbFreeDevice (IN USB_DEVICE *Device)
 
USB_DEVICEUsbCreateDevice (IN USB_INTERFACE *ParentIf, IN UINT8 ParentPort)
 
EFI_STATUS UsbConnectDriver (IN USB_INTERFACE *UsbIf)
 
EFI_STATUS UsbSelectSetting (IN USB_INTERFACE_DESC *IfDesc, IN UINT8 Alternate)
 
EFI_STATUS UsbSelectConfig (IN USB_DEVICE *Device, IN UINT8 ConfigValue)
 
EFI_STATUS UsbDisconnectDriver (IN USB_INTERFACE *UsbIf)
 
EFI_STATUS UsbRemoveConfig (IN USB_DEVICE *Device)
 
EFI_STATUS UsbRemoveDevice (IN USB_DEVICE *Device)
 
USB_DEVICEUsbFindChild (IN USB_INTERFACE *HubIf, IN UINT8 Port)
 
EFI_STATUS UsbEnumerateNewDev (IN USB_INTERFACE *HubIf, IN UINT8 Port, IN BOOLEAN ResetIsNeeded)
 
EFI_STATUS UsbEnumeratePort (IN USB_INTERFACE *HubIf, IN UINT8 Port)
 
VOID EFIAPI UsbHubEnumeration (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI UsbRootHubEnumeration (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

Usb bus enumeration support.

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbEnumer.c.

Function Documentation

◆ UsbConnectDriver()

EFI_STATUS UsbConnectDriver ( IN USB_INTERFACE UsbIf)

Connect the USB interface with its driver. EFI USB bus will create a USB interface for each separate interface descriptor.

Parameters
UsbIfThe interface to connect driver to.
Returns
EFI_SUCCESS Interface is managed by some driver.
Others Failed to locate a driver for this interface.

Definition at line 250 of file UsbEnumer.c.

◆ UsbCreateDevice()

USB_DEVICE * UsbCreateDevice ( IN USB_INTERFACE ParentIf,
IN UINT8  ParentPort 
)

Create a device which is on the parent's ParentPort port.

Parameters
ParentIfThe parent HUB interface.
ParentPortThe port on the HUB this device is connected to.
Returns
Created USB device, Or NULL.

Definition at line 215 of file UsbEnumer.c.

◆ UsbCreateInterface()

USB_INTERFACE * UsbCreateInterface ( IN USB_DEVICE Device,
IN USB_INTERFACE_DESC IfDesc 
)

Create an interface for the descriptor IfDesc. Each device's configuration can have several interfaces.

Parameters
DeviceThe device has the interface descriptor.
IfDescThe interface descriptor.
Returns
The created USB interface for the descriptor, or NULL.

Definition at line 93 of file UsbEnumer.c.

◆ UsbDisconnectDriver()

EFI_STATUS UsbDisconnectDriver ( IN USB_INTERFACE UsbIf)

Disconnect the USB interface with its driver.

Parameters
UsbIfThe interface to disconnect driver from.

Definition at line 461 of file UsbEnumer.c.

◆ UsbEnumerateNewDev()

EFI_STATUS UsbEnumerateNewDev ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
IN BOOLEAN  ResetIsNeeded 
)

Enumerate and configure the new device on the port of this HUB interface.

Parameters
HubIfThe HUB that has the device connected.
PortThe port index of the hub (started with zero).
ResetIsNeededThe boolean to control whether skip the reset of the port.
Return values
EFI_SUCCESSThe device is enumerated (added or removed).
EFI_OUT_OF_RESOURCESFailed to allocate resource for the device.
OthersFailed to enumerate the device.

Definition at line 662 of file UsbEnumer.c.

◆ UsbEnumeratePort()

EFI_STATUS UsbEnumeratePort ( IN USB_INTERFACE HubIf,
IN UINT8  Port 
)

Process the events on the port.

Parameters
HubIfThe HUB that has the device connected.
PortThe port index of the hub (started with zero).
Return values
EFI_SUCCESSThe device is enumerated (added or removed).
EFI_OUT_OF_RESOURCESFailed to allocate resource for the device.
OthersFailed to enumerate the device.

Definition at line 890 of file UsbEnumer.c.

◆ UsbFindChild()

USB_DEVICE * UsbFindChild ( IN USB_INTERFACE HubIf,
IN UINT8  Port 
)

Find the child device on the hub's port.

Parameters
HubIfThe hub interface.
PortThe port of the hub this child is connected to.
Returns
The device on the hub's port, or NULL if there is none.

Definition at line 622 of file UsbEnumer.c.

◆ UsbFreeDevice()

VOID UsbFreeDevice ( IN USB_DEVICE Device)

Free the resource used by this USB device.

Parameters
DeviceThe USB device to free.

Definition at line 194 of file UsbEnumer.c.

◆ UsbFreeInterface()

EFI_STATUS UsbFreeInterface ( IN USB_INTERFACE UsbIf)

Free the resource used by USB interface.

Parameters
UsbIfThe USB interface to free.
Return values
EFI_ACCESS_DENIEDThe interface is still occupied.
EFI_SUCCESSThe interface is freed.

Definition at line 53 of file UsbEnumer.c.

◆ UsbGetEndpointDesc()

USB_ENDPOINT_DESC * UsbGetEndpointDesc ( IN USB_INTERFACE UsbIf,
IN UINT8  EpAddr 
)

Return the endpoint descriptor in this interface.

Parameters
UsbIfThe interface to search in.
EpAddrThe address of the endpoint to return.
Returns
The endpoint descriptor or NULL.

Definition at line 22 of file UsbEnumer.c.

◆ UsbHubEnumeration()

VOID EFIAPI UsbHubEnumeration ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Enumerate all the changed hub ports.

Parameters
EventThe event that is triggered.
ContextThe context to the event.

Definition at line 1012 of file UsbEnumer.c.

◆ UsbRemoveConfig()

EFI_STATUS UsbRemoveConfig ( IN USB_DEVICE Device)

Remove the current device configuration.

Parameters
DeviceThe USB device to remove configuration from.

Definition at line 509 of file UsbEnumer.c.

◆ UsbRemoveDevice()

EFI_STATUS UsbRemoveDevice ( IN USB_DEVICE Device)

Remove the device and all its children from the bus.

Parameters
DeviceThe device to remove.
Return values
EFI_SUCCESSThe device is removed.

Definition at line 558 of file UsbEnumer.c.

◆ UsbRootHubEnumeration()

VOID EFIAPI UsbRootHubEnumeration ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Enumerate all the changed hub ports.

Parameters
EventThe event that is triggered.
ContextThe context to the event.

Definition at line 1069 of file UsbEnumer.c.

◆ UsbSelectConfig()

EFI_STATUS UsbSelectConfig ( IN USB_DEVICE Device,
IN UINT8  ConfigValue 
)

Select a new configuration for the device. Each device may support several configurations.

Parameters
DeviceThe device to select configuration.
ConfigValueThe index of the configuration ( != 0).
Return values
EFI_NOT_FOUNDThere is no configuration with the index.
EFI_OUT_OF_RESOURCESFailed to allocate resource.
EFI_SUCCESSThe configuration is selected.

Definition at line 370 of file UsbEnumer.c.

◆ UsbSelectSetting()

EFI_STATUS UsbSelectSetting ( IN USB_INTERFACE_DESC IfDesc,
IN UINT8  Alternate 
)

Select an alternate setting for the interface. Each interface can have several mutually exclusive settings. Only one setting is active. It will also reset its endpoints' toggle to zero.

Parameters
IfDescThe interface descriptor to set.
AlternateThe alternate setting number to locate.
Return values
EFI_NOT_FOUNDThere is no setting with this alternate index.
EFI_SUCCESSThe interface is set to Alternate setting.

Definition at line 311 of file UsbEnumer.c.