TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbPeim.c File Reference
#include "UsbPeim.h"
#include "HubPeim.h"
#include "PeiUsbLib.h"

Go to the source code of this file.

Functions

EFI_STATUS PeiUsbEnumeration (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi, IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi)
 
EFI_STATUS PeiConfigureUsbDevice (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN UINT8 Port, IN OUT UINT8 *DeviceAddress)
 
EFI_STATUS PeiUsbGetAllConfiguration (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice)
 
EFI_STATUS GetExpectedDescriptor (IN UINT8 *Buffer, IN UINTN Length, IN UINT8 DescType, IN UINT8 DescLength, OUT UINTN *ParsedBytes)
 
EFI_STATUS EFIAPI PeimInitializeUsb (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 
EFI_STATUS PeiHubEnumeration (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN UINT8 *CurrentAddress)
 
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)
 

Variables

PEI_USB_IO_PPI mUsbIoPpi
 
EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList
 

Detailed Description

The module to produce Usb Bus PPI.

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

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

Definition in file UsbPeim.c.

Function Documentation

◆ GetExpectedDescriptor()

EFI_STATUS GetExpectedDescriptor ( IN UINT8 *  Buffer,
IN UINTN  Length,
IN UINT8  DescType,
IN UINT8  DescLength,
OUT UINTN ParsedBytes 
)

Get the start position of next wanted descriptor.

Parameters
BufferBuffer containing data to parse.
LengthBuffer length.
DescTypeDescriptor type.
DescLengthDescriptor length.
ParsedBytesBytes has been parsed.
Return values
EFI_SUCCESSGet wanted descriptor successfully.
EFI_DEVICE_ERRORError occurred.

Definition at line 953 of file UsbPeim.c.

◆ PeiConfigureUsbDevice()

EFI_STATUS PeiConfigureUsbDevice ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_DEVICE PeiUsbDevice,
IN UINT8  Port,
IN OUT UINT8 *  DeviceAddress 
)

Configure new detected usb device.

Parameters
PeiServicesDescribes the list of possible PEI Services.
PeiUsbDeviceThe pointer of PEI_USB_DEVICE instance.
PortThe port to be configured.
DeviceAddressThe device address to be configured.
Return values
EFI_SUCCESSThe new detected usb device is configured successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.
OthersOther failure occurs.

Definition at line 664 of file UsbPeim.c.

◆ PeiHubEnumeration()

EFI_STATUS PeiHubEnumeration ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_DEVICE PeiUsbDevice,
IN UINT8 *  CurrentAddress 
)

The Hub Enumeration just scans the hub ports one time. It also doesn't support hot-plug.

Parameters
PeiServicesDescribes the list of possible PEI Services.
PeiUsbDeviceThe pointer of PEI_USB_DEVICE instance.
CurrentAddressThe DeviceAddress of usb device.
Return values
EFI_SUCCESSThe usb hub is enumerated successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.
OthersOther failure occurs.

Definition at line 207 of file UsbPeim.c.

◆ PeimInitializeUsb()

EFI_STATUS EFIAPI PeimInitializeUsb ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

The entrypoint of the module, it will enumerate all HCs.

Parameters
FileHandleHandle of the file being invoked.
PeiServicesDescribes the list of possible PEI Services.
Return values
EFI_SUCCESSUsb initialization is done successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.
EFI_UNSUPPORTEDCan't find required PPI.

Definition at line 123 of file UsbPeim.c.

◆ PeiUsbEnumeration()

EFI_STATUS PeiUsbEnumeration ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI UsbHcPpi,
IN PEI_USB2_HOST_CONTROLLER_PPI Usb2HcPpi 
)

The enumeration routine to detect device change.

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.
Return values
EFI_SUCCESSThe usb is enumerated successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.
OthersOther failure occurs.

Definition at line 415 of file UsbPeim.c.

◆ PeiUsbGetAllConfiguration()

EFI_STATUS PeiUsbGetAllConfiguration ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_DEVICE PeiUsbDevice 
)

Get all configurations from a detected usb device.

Parameters
PeiServicesDescribes the list of possible PEI Services.
PeiUsbDeviceThe pointer of PEI_USB_DEVICE instance.
Return values
EFI_SUCCESSThe new detected usb device is configured successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.
OthersOther failure occurs.

Definition at line 781 of file UsbPeim.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.

Variable Documentation

◆ mUsbIoPpi

PEI_USB_IO_PPI mUsbIoPpi
Initial value:
= {
}
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)
Definition: UsbIoPeim.c:151
EFI_STATUS EFIAPI PeiUsbGetInterfaceDescriptor(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor)
Definition: UsbIoPeim.c:254
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)
Definition: UsbIoPeim.c:35
EFI_STATUS EFIAPI PeiUsbGetEndpointDescriptor(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This, IN UINT8 EndpointIndex, OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor)
Definition: UsbIoPeim.c:281
EFI_STATUS EFIAPI PeiUsbPortReset(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *This)
Definition: UsbIoPeim.c:322

Definition at line 17 of file UsbPeim.c.

◆ mUsbIoPpiList

EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList
Initial value:
= {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gPeiUsbIoPpiGuid,
}
#define NULL
Definition: Base.h:319

Definition at line 25 of file UsbPeim.c.