TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbPeim.h File Reference

Go to the source code of this file.

Data Structures

struct  USB_DESC_HEAD
 
struct  PEI_USB_DEVICE
 

Macros

#define MAX_INTERFACE   8
 
#define MAX_ENDPOINT   16
 
#define PEI_USB_DEVICE_SIGNATURE   SIGNATURE_32 ('U', 's', 'b', 'D')
 
#define PEI_USB_DEVICE_FROM_THIS(a)   CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)
 
#define USB_BIT_IS_SET(Data, Bit)   ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
 
#define USB_BUS_1_MILLISECOND   1000
 
#define USB_SET_PORT_RESET_STALL   (20 * USB_BUS_1_MILLISECOND)
 
#define USB_SET_ROOT_PORT_RESET_STALL   (50 * USB_BUS_1_MILLISECOND)
 
#define USB_CLR_ROOT_PORT_RESET_STALL   (20 * USB_BUS_1_MILLISECOND)
 
#define USB_WAIT_PORT_STS_CHANGE_STALL   (100)
 
#define USB_WAIT_PORT_STS_CHANGE_LOOP   5000
 
#define USB_SET_PORT_POWER_STALL   (2 * USB_BUS_1_MILLISECOND)
 
#define USB_SET_DEVICE_ADDRESS_STALL   (2 * USB_BUS_1_MILLISECOND)
 
#define USB_GET_CONFIG_DESCRIPTOR_STALL   (1 * USB_BUS_1_MILLISECOND)
 

Functions

EFI_STATUS EFIAPI PeiUsbControlTransfer (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION Direction, IN UINT32 Timeout, IN OUT VOID *Data OPTIONAL, IN UINTN DataLength OPTIONAL)
 
EFI_STATUS EFIAPI PeiUsbBulkTransfer (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, IN UINT8 DeviceEndpoint, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN Timeout)
 
EFI_STATUS EFIAPI PeiUsbGetInterfaceDescriptor (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor)
 
EFI_STATUS EFIAPI PeiUsbGetEndpointDescriptor (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, IN UINT8 EndpointIndex, OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor)
 
EFI_STATUS EFIAPI PeiUsbPortReset (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This)
 
VOID ResetRootPort (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi, IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi, IN UINT8 PortNum, IN UINT8 RetryIndex)
 

Detailed Description

Usb Peim definition.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbPeim.h.

Macro Definition Documentation

◆ MAX_ENDPOINT

#define MAX_ENDPOINT   16

Definition at line 40 of file UsbPeim.h.

◆ MAX_INTERFACE

#define MAX_INTERFACE   8

Definition at line 39 of file UsbPeim.h.

◆ PEI_USB_DEVICE_FROM_THIS

#define PEI_USB_DEVICE_FROM_THIS (   a)    CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)

Definition at line 66 of file UsbPeim.h.

◆ PEI_USB_DEVICE_SIGNATURE

#define PEI_USB_DEVICE_SIGNATURE   SIGNATURE_32 ('U', 's', 'b', 'D')

Definition at line 42 of file UsbPeim.h.

◆ USB_BIT_IS_SET

#define USB_BIT_IS_SET (   Data,
  Bit 
)    ((BOOLEAN)(((Data) & (Bit)) == (Bit)))

Definition at line 68 of file UsbPeim.h.

◆ USB_BUS_1_MILLISECOND

#define USB_BUS_1_MILLISECOND   1000

Definition at line 70 of file UsbPeim.h.

◆ USB_CLR_ROOT_PORT_RESET_STALL

#define USB_CLR_ROOT_PORT_RESET_STALL   (20 * USB_BUS_1_MILLISECOND)

Definition at line 86 of file UsbPeim.h.

◆ USB_GET_CONFIG_DESCRIPTOR_STALL

#define USB_GET_CONFIG_DESCRIPTOR_STALL   (1 * USB_BUS_1_MILLISECOND)

Definition at line 114 of file UsbPeim.h.

◆ USB_SET_DEVICE_ADDRESS_STALL

#define USB_SET_DEVICE_ADDRESS_STALL   (2 * USB_BUS_1_MILLISECOND)

Definition at line 109 of file UsbPeim.h.

◆ USB_SET_PORT_POWER_STALL

#define USB_SET_PORT_POWER_STALL   (2 * USB_BUS_1_MILLISECOND)

Definition at line 103 of file UsbPeim.h.

◆ USB_SET_PORT_RESET_STALL

#define USB_SET_PORT_RESET_STALL   (20 * USB_BUS_1_MILLISECOND)

Definition at line 80 of file UsbPeim.h.

◆ USB_SET_ROOT_PORT_RESET_STALL

#define USB_SET_ROOT_PORT_RESET_STALL   (50 * USB_BUS_1_MILLISECOND)

Definition at line 81 of file UsbPeim.h.

◆ USB_WAIT_PORT_STS_CHANGE_LOOP

#define USB_WAIT_PORT_STS_CHANGE_LOOP   5000

Definition at line 97 of file UsbPeim.h.

◆ USB_WAIT_PORT_STS_CHANGE_STALL

#define USB_WAIT_PORT_STS_CHANGE_STALL   (100)

Definition at line 91 of file UsbPeim.h.

Function Documentation

◆ PeiUsbBulkTransfer()

EFI_STATUS EFIAPI PeiUsbBulkTransfer ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_IO_PPI This,
IN UINT8  DeviceEndpoint,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN UINTN  Timeout 
)

Submits bulk transfer to a bulk endpoint of a USB device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_IO_PPI.
DeviceEndpointEndpoint number and its direction in bit 7.
DataA pointer to the buffer of data to transmit from or receive into.
DataLengthThe length of the data buffer.
TimeoutIndicates the maximum time, in millisecond, which the transfer is allowed to complete. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.
Return values
EFI_SUCCESSThe transfer was completed successfully.
EFI_OUT_OF_RESOURCESThe transfer failed due to lack of resource.
EFI_INVALID_PARAMETERParameters are invalid.
EFI_TIMEOUTThe transfer failed due to timeout.
EFI_DEVICE_ERRORThe transfer failed due to host controller error.

Definition at line 151 of file UsbIoPeim.c.

◆ PeiUsbControlTransfer()

EFI_STATUS EFIAPI PeiUsbControlTransfer ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_IO_PPI This,
IN EFI_USB_DEVICE_REQUEST Request,
IN EFI_USB_DATA_DIRECTION  Direction,
IN UINT32  Timeout,
IN OUT VOID *Data  OPTIONAL,
IN UINTN DataLength  OPTIONAL 
)

Submits control transfer to a target USB device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_IO_PPI.
RequestUSB device request to send.
DirectionSpecifies the data direction for the data stage.
TimeoutIndicates the maximum timeout, in millisecond. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.
DataData buffer to be transmitted or received from USB device.
DataLengthThe size (in bytes) of the data buffer.
Return values
EFI_SUCCESSTransfer was completed successfully.
EFI_OUT_OF_RESOURCESThe transfer failed due to lack of resources.
EFI_INVALID_PARAMETERSome parameters are invalid.
EFI_TIMEOUTTransfer failed due to timeout.
EFI_DEVICE_ERRORTransfer failed due to host controller or device error.

Definition at line 35 of file UsbIoPeim.c.

◆ PeiUsbGetEndpointDescriptor()

EFI_STATUS EFIAPI PeiUsbGetEndpointDescriptor ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_IO_PPI This,
IN UINT8  EndpointIndex,
OUT EFI_USB_ENDPOINT_DESCRIPTOR **  EndpointDescriptor 
)

Get the usb endpoint descriptor.

Parameters
PeiServicesGeneral-purpose services that are available to every PEIM.
ThisIndicates the PEI_USB_IO_PPI instance.
EndpointIndexThe valid index of the specified endpoint.
EndpointDescriptorRequest endpoint descriptor.
Return values
EFI_SUCCESSUsb endpoint descriptor is obtained successfully.
EFI_NOT_FOUNDUsb endpoint descriptor is NOT found.

Definition at line 281 of file UsbIoPeim.c.

◆ PeiUsbGetInterfaceDescriptor()

EFI_STATUS EFIAPI PeiUsbGetInterfaceDescriptor ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_IO_PPI This,
OUT EFI_USB_INTERFACE_DESCRIPTOR **  InterfaceDescriptor 
)

Get the usb interface descriptor.

Parameters
PeiServicesGeneral-purpose services that are available to every PEIM.
ThisIndicates the PEI_USB_IO_PPI instance.
InterfaceDescriptorRequest interface descriptor.
Return values
EFI_SUCCESSUsb interface descriptor is obtained successfully.

Definition at line 254 of file UsbIoPeim.c.

◆ PeiUsbPortReset()

EFI_STATUS EFIAPI PeiUsbPortReset ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_IO_PPI This 
)

Reset the port and re-configure the usb device.

Parameters
PeiServicesGeneral-purpose services that are available to every PEIM.
ThisIndicates the PEI_USB_IO_PPI instance.
Return values
EFI_SUCCESSUsb device is reset and configured successfully.
OthersOther failure occurs.

Definition at line 322 of file UsbIoPeim.c.

◆ ResetRootPort()

VOID ResetRootPort ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI UsbHcPpi,
IN PEI_USB2_HOST_CONTROLLER_PPI Usb2HcPpi,
IN UINT8  PortNum,
IN UINT8  RetryIndex 
)

Send reset signal over the given root hub port.

Parameters
PeiServicesDescribes the list of possible PEI Services.
UsbHcPpiThe pointer of PEI_USB_HOST_CONTROLLER_PPI instance.
Usb2HcPpiThe pointer of PEI_USB2_HOST_CONTROLLER_PPI instance.
PortNumThe port to be reset.
RetryIndexThe retry times.

Definition at line 1033 of file UsbPeim.c.