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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI XhcGetCapability (IN EFI_USB2_HC_PROTOCOL *This, OUT UINT8 *MaxSpeed, OUT UINT8 *PortNumber, OUT UINT8 *Is64BitCapable)
 
EFI_STATUS EFIAPI XhcReset (IN EFI_USB2_HC_PROTOCOL *This, IN UINT16 Attributes)
 
EFI_STATUS EFIAPI XhcGetState (IN EFI_USB2_HC_PROTOCOL *This, OUT EFI_USB_HC_STATE *State)
 
EFI_STATUS EFIAPI XhcSetState (IN EFI_USB2_HC_PROTOCOL *This, IN EFI_USB_HC_STATE State)
 
EFI_STATUS EFIAPI XhcGetRootHubPortStatus (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
 
EFI_STATUS EFIAPI XhcSetRootHubPortFeature (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
 
EFI_STATUS EFIAPI XhcClearRootHubPortFeature (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
 
EFI_STATUS XhcTransfer (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINTN Type, IN EFI_USB_DEVICE_REQUEST *Request, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN Timeout, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI XhcControlTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION TransferDirection, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI XhcBulkTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI XhcAsyncInterruptTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN BOOLEAN IsNewTransfer, IN OUT UINT8 *DataToggle, IN UINTN PollingInterval, IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, IN VOID *Context OPTIONAL)
 
EFI_STATUS EFIAPI XhcSyncInterruptTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI XhcIsochronousTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI XhcAsyncIsochronousTransfer (IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack, IN VOID *Context)
 
EFI_STATUS EFIAPI XhcDriverEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI XhcDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
USB_XHCI_INSTANCEXhcCreateUsbHc (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINT64 OriginalPciAttributes)
 
VOID EFIAPI XhcExitBootService (EFI_EVENT Event, VOID *Context)
 
EFI_STATUS EFIAPI XhcDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI XhcDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
UINT64 XhcConvertTimeToTicks (IN UINT64 Time)
 
UINT64 XhcGetElapsedTicks (IN OUT UINT64 *PreviousTick)
 

Variables

USB_PORT_STATE_MAP mUsbPortStateMap []
 
USB_PORT_STATE_MAP mUsbPortChangeMap []
 
USB_CLEAR_PORT_MAP mUsbClearPortChangeMap []
 
USB_PORT_STATE_MAP mUsbHubPortStateMap []
 
USB_PORT_STATE_MAP mUsbHubPortChangeMap []
 
USB_CLEAR_PORT_MAP mUsbHubClearPortChangeMap []
 
EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding
 
EFI_USB2_HC_PROTOCOL gXhciUsb2HcTemplate
 

Detailed Description

The XHCI controller driver.

(C) Copyright 2023 Hewlett Packard Enterprise Development LP
Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Xhci.c.

Function Documentation

◆ XhcAsyncInterruptTransfer()

EFI_STATUS EFIAPI XhcAsyncInterruptTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN BOOLEAN  IsNewTransfer,
IN OUT UINT8 *  DataToggle,
IN UINTN  PollingInterval,
IN UINTN  DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  CallBackFunction,
IN VOID *Context  OPTIONAL 
)

Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressTarget device address.
EndPointAddressEndpoint number and its direction encoded in bit 7
DeviceSpeedIndicates device speed.
MaximumPacketLengthMaximum packet size the target endpoint is capable
IsNewTransferIf TRUE, to submit an new asynchronous interrupt transfer If FALSE, to remove the specified asynchronous interrupt.
DataToggleOn input, the initial data toggle to use; on output, it is updated to indicate the next data toggle.
PollingIntervalThe he interval, in milliseconds, that the transfer is polled.
DataLengthThe length of data to receive at the rate specified by PollingInterval.
TranslatorTransaction translator to use.
CallBackFunctionFunction to call at the rate specified by PollingInterval.
ContextContext to CallBackFunction.
Return values
EFI_SUCCESSThe request has been successfully submitted or canceled.
EFI_INVALID_PARAMETERSome parameters are invalid.
EFI_OUT_OF_RESOURCESThe request failed due to a lack of resources.
EFI_DEVICE_ERRORThe transfer failed due to host controller error.

Definition at line 1377 of file Xhci.c.

◆ XhcAsyncIsochronousTransfer()

EFI_STATUS EFIAPI XhcAsyncIsochronousTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN UINT8  DataBuffersNumber,
IN OUT VOID *  Data[EFI_USB_MAX_ISO_BUFFER_NUM],
IN UINTN  DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  IsochronousCallBack,
IN VOID *  Context 
)

Submits Async isochronous transfer to a target USB device.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressTarget device address.
EndPointAddressEnd point address with its direction.
DeviceSpeedDevice speed, Low speed device doesn't support this type.
MaximumPacketLengthMaximum packet size that the endpoint is capable of sending or receiving.
DataBuffersNumberNumber of data buffers prepared for the transfer.
DataArray of pointers to the buffers of data that will be transmitted to USB device or received from USB device.
DataLengthThe size, in bytes, of the data buffer.
TranslatorTransaction translator to use.
IsochronousCallBackFunction to be called when the transfer complete.
ContextContext passed to the call back function as parameter.
Returns
EFI_UNSUPPORTED Isochronous transfer isn't supported.

Definition at line 1666 of file Xhci.c.

◆ XhcBulkTransfer()

EFI_STATUS EFIAPI XhcBulkTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN UINT8  DataBuffersNumber,
IN OUT VOID *  Data[EFI_USB_MAX_BULK_BUFFER_NUM],
IN OUT UINTN DataLength,
IN OUT UINT8 *  DataToggle,
IN UINTN  Timeout,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  TransferResult 
)

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

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressTarget device address.
EndPointAddressEndpoint number and its direction in bit 7.
DeviceSpeedDevice speed, Low speed device doesn't support bulk transfer.
MaximumPacketLengthMaximum packet size the endpoint is capable of sending or receiving.
DataBuffersNumberNumber of data buffers prepared for the transfer.
DataArray of pointers to the buffers of data to transmit from or receive into.
DataLengthThe lenght of the data buffer.
DataToggleOn input, the initial data toggle for the transfer; On output, it is updated to to next data toggle to use of the subsequent bulk transfer.
TimeoutIndicates the maximum time, in millisecond, which the transfer is allowed to complete.
TranslatorA pointr to the transaction translator data.
TransferResultA pointer to the detailed result information of the bulk transfer.
Return values
EFI_SUCCESSThe transfer was completed successfully.
EFI_OUT_OF_RESOURCESThe transfer failed due to lack of resource.
EFI_INVALID_PARAMETERSome parameters are invalid.
EFI_TIMEOUTThe transfer failed due to timeout.
EFI_DEVICE_ERRORThe transfer failed due to host controller error.

Definition at line 1250 of file Xhci.c.

◆ XhcClearRootHubPortFeature()

EFI_STATUS EFIAPI XhcClearRootHubPortFeature ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  PortNumber,
IN EFI_USB_PORT_FEATURE  PortFeature 
)

Clears a feature for the specified root hub port.

Parameters
ThisA pointer to the EFI_USB2_HC_PROTOCOL instance.
PortNumberSpecifies the root hub port whose feature is requested to be cleared.
PortFeatureIndicates the feature selector associated with the feature clear request.
Return values
EFI_SUCCESSThe feature specified by PortFeature was cleared for the USB root hub port specified by PortNumber.
EFI_INVALID_PARAMETERPortNumber is invalid or PortFeature is invalid.
EFI_DEVICE_ERRORCan't read register.

Definition at line 626 of file Xhci.c.

◆ XhcControlTransfer()

EFI_STATUS EFIAPI XhcControlTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN EFI_USB_DEVICE_REQUEST Request,
IN EFI_USB_DATA_DIRECTION  TransferDirection,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN UINTN  Timeout,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  TransferResult 
)

Submits control transfer to a target USB device.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressThe target device address.
DeviceSpeedTarget device speed.
MaximumPacketLengthMaximum packet size the default control transfer endpoint is capable of sending or receiving.
RequestUSB device request to send.
TransferDirectionSpecifies the data direction for the data stage
DataData buffer to be transmitted or received from USB device.
DataLengthThe size (in bytes) of the data buffer.
TimeoutIndicates the maximum timeout, in millisecond.
TranslatorTransaction translator to be used by this device.
TransferResultReturn the result of this control transfer.
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 870 of file Xhci.c.

◆ XhcConvertTimeToTicks()

UINT64 XhcConvertTimeToTicks ( IN UINT64  Time)

Converts a time in nanoseconds to a performance counter tick count.

Parameters
TimeThe time in nanoseconds to be converted to performance counter ticks.
Returns
Time in nanoseconds converted to ticks.

Definition at line 2319 of file Xhci.c.

◆ XhcCreateUsbHc()

USB_XHCI_INSTANCE * XhcCreateUsbHc ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
IN UINT64  OriginalPciAttributes 
)

Create and initialize a USB_XHCI_INSTANCE structure.

Parameters
PciIoThe PciIo on this device.
DevicePathThe device path of host controller.
OriginalPciAttributesOriginal PCI attributes.
Returns
The allocated and initialized USB_XHCI_INSTANCE structure if created, otherwise NULL.

Definition at line 1797 of file Xhci.c.

◆ XhcDriverBindingStart()

EFI_STATUS EFIAPI XhcDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Starting the Usb XHCI Driver.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to test.
RemainingDevicePathNot used.
Returns
EFI_SUCCESS supports this device.
EFI_UNSUPPORTED do not support this device.
EFI_DEVICE_ERROR cannot be started due to device Error.
EFI_OUT_OF_RESOURCES cannot allocate resources.

Definition at line 1963 of file Xhci.c.

◆ XhcDriverBindingStop()

EFI_STATUS EFIAPI XhcDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Stop this driver on ControllerHandle. Support stopping any child handles created by this driver.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to stop driver on.
NumberOfChildrenNumber of Children in the ChildHandleBuffer.
ChildHandleBufferList of handles for the children we need to stop.
Returns
EFI_SUCCESS Success.
EFI_DEVICE_ERROR Fail.

Definition at line 2205 of file Xhci.c.

◆ XhcDriverBindingSupported()

EFI_STATUS EFIAPI XhcDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Test to see if this driver supports ControllerHandle. Any ControllerHandle that has Usb2HcProtocol installed will be supported.

Parameters
ThisProtocol instance pointer.
ControllerHandle of device to test.
RemainingDevicePathNot used.
Returns
EFI_SUCCESS This driver supports this device.
EFI_UNSUPPORTED This driver does not support this device.

Definition at line 1725 of file Xhci.c.

◆ XhcDriverEntryPoint()

EFI_STATUS EFIAPI XhcDriverEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entry point for EFI drivers.

Parameters
ImageHandleEFI_HANDLE.
SystemTableEFI_SYSTEM_TABLE.
Return values
EFI_SUCCESSSuccess.
OthersFail.

Definition at line 1695 of file Xhci.c.

◆ XhcExitBootService()

VOID EFIAPI XhcExitBootService ( EFI_EVENT  Event,
VOID *  Context 
)

One notified function to stop the Host Controller when gBS->ExitBootServices() called.

Parameters
EventPointer to this event
ContextEvent handler private data

Definition at line 1912 of file Xhci.c.

◆ XhcGetCapability()

EFI_STATUS EFIAPI XhcGetCapability ( IN EFI_USB2_HC_PROTOCOL This,
OUT UINT8 *  MaxSpeed,
OUT UINT8 *  PortNumber,
OUT UINT8 *  Is64BitCapable 
)

Retrieves the capability of root hub ports.

Parameters
ThisThe EFI_USB2_HC_PROTOCOL instance.
MaxSpeedMax speed supported by the controller.
PortNumberNumber of the root hub ports.
Is64BitCapableWhether the controller supports 64-bit memory addressing.
Return values
EFI_SUCCESSHost controller capability were retrieved successfully.
EFI_INVALID_PARAMETEREither of the three capability pointer is NULL.

Definition at line 109 of file Xhci.c.

◆ XhcGetElapsedTicks()

UINT64 XhcGetElapsedTicks ( IN OUT UINT64 *  PreviousTick)

Computes and returns the elapsed ticks since PreviousTick. The value of PreviousTick is overwritten with the current performance counter value.

Parameters
PreviousTickPointer to PreviousTick count.
Returns
The elapsed ticks since PreviousCount. PreviousCount is overwritten with the current performance counter value.

Definition at line 2383 of file Xhci.c.

◆ XhcGetRootHubPortStatus()

EFI_STATUS EFIAPI XhcGetRootHubPortStatus ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  PortNumber,
OUT EFI_USB_PORT_STATUS PortStatus 
)

Retrieves the current status of a USB root hub port.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
PortNumberThe root hub port to retrieve the state from. This value is zero-based.
PortStatusVariable to receive the port state.
Return values
EFI_SUCCESSThe status of the USB root hub port specified. by PortNumber was returned in PortStatus.
EFI_INVALID_PARAMETERPortNumber is invalid.
EFI_DEVICE_ERRORCan't read register.

Definition at line 368 of file Xhci.c.

◆ XhcGetState()

EFI_STATUS EFIAPI XhcGetState ( IN EFI_USB2_HC_PROTOCOL This,
OUT EFI_USB_HC_STATE State 
)

Retrieve the current state of the USB host controller.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
StateVariable to return the current host controller state.
Return values
EFI_SUCCESSHost controller state was returned in State.
EFI_INVALID_PARAMETERState is NULL.
EFI_DEVICE_ERRORAn error was encountered while attempting to retrieve the host controller's current state.

Definition at line 248 of file Xhci.c.

◆ XhcIsochronousTransfer()

EFI_STATUS EFIAPI XhcIsochronousTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN UINT8  DataBuffersNumber,
IN OUT VOID *  Data[EFI_USB_MAX_ISO_BUFFER_NUM],
IN UINTN  DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  TransferResult 
)

Submits isochronous transfer to a target USB device.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressTarget device address.
EndPointAddressEnd point address with its direction.
DeviceSpeedDevice speed, Low speed device doesn't support this type.
MaximumPacketLengthMaximum packet size that the endpoint is capable of sending or receiving.
DataBuffersNumberNumber of data buffers prepared for the transfer.
DataArray of pointers to the buffers of data that will be transmitted to USB device or received from USB device.
DataLengthThe size, in bytes, of the data buffer.
TranslatorTransaction translator to use.
TransferResultVariable to receive the transfer result.
Returns
EFI_UNSUPPORTED Isochronous transfer is unsupported.

Definition at line 1625 of file Xhci.c.

◆ XhcReset()

EFI_STATUS EFIAPI XhcReset ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT16  Attributes 
)

Provides software reset for the USB host controller.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
AttributesA bit mask of the reset operation to perform.
Return values
EFI_SUCCESSThe reset operation succeeded.
EFI_INVALID_PARAMETERAttributes is not valid.
EFI_UNSUPPOURTEDThe type of reset specified by Attributes is not currently supported by the host controller.
EFI_DEVICE_ERRORHost controller isn't halted to reset.

Definition at line 151 of file Xhci.c.

◆ XhcSetRootHubPortFeature()

EFI_STATUS EFIAPI XhcSetRootHubPortFeature ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  PortNumber,
IN EFI_USB_PORT_FEATURE  PortFeature 
)

Sets a feature for the specified root hub port.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
PortNumberRoot hub port to set.
PortFeatureFeature to set.
Return values
EFI_SUCCESSThe feature specified by PortFeature was set.
EFI_INVALID_PARAMETERPortNumber is invalid or PortFeature is invalid.
EFI_DEVICE_ERRORCan't read register.

Definition at line 510 of file Xhci.c.

◆ XhcSetState()

EFI_STATUS EFIAPI XhcSetState ( IN EFI_USB2_HC_PROTOCOL This,
IN EFI_USB_HC_STATE  State 
)

Sets the USB host controller to a specific state.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
StateThe state of the host controller that will be set.
Return values
EFI_SUCCESSThe USB host controller was successfully placed in the state specified by State.
EFI_INVALID_PARAMETERState is invalid.
EFI_DEVICE_ERRORFailed to set the state due to device error.

Definition at line 290 of file Xhci.c.

◆ XhcSyncInterruptTransfer()

EFI_STATUS EFIAPI XhcSyncInterruptTransfer ( IN EFI_USB2_HC_PROTOCOL This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN OUT UINT8 *  DataToggle,
IN UINTN  Timeout,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator,
OUT UINT32 *  TransferResult 
)

Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.

Parameters
ThisThis EFI_USB2_HC_PROTOCOL instance.
DeviceAddressTarget device address.
EndPointAddressEndpoint number and its direction encoded in bit 7
DeviceSpeedIndicates device speed.
MaximumPacketLengthMaximum packet size the target endpoint is capable of sending or receiving.
DataBuffer of data that will be transmitted to USB device or received from USB device.
DataLengthOn input, the size, in bytes, of the data buffer; On output, the number of bytes transferred.
DataToggleOn input, the initial data toggle to use; on output, it is updated to indicate the next data toggle.
TimeoutMaximum time, in second, to complete.
TranslatorTransaction translator to use.
TransferResultVariable to receive the transfer result.
Returns
EFI_SUCCESS The transfer was completed successfully.
EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
EFI_INVALID_PARAMETER Some parameters are invalid.
EFI_TIMEOUT The transfer failed due to timeout.
EFI_DEVICE_ERROR The failed due to host controller or device error

Definition at line 1519 of file Xhci.c.

◆ XhcTransfer()

EFI_STATUS XhcTransfer ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  DeviceSpeed,
IN UINTN  MaximumPacketLength,
IN UINTN  Type,
IN EFI_USB_DEVICE_REQUEST Request,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN UINTN  Timeout,
OUT UINT32 *  TransferResult 
)

Submits a new transaction to a target USB device.

Parameters
XhcThe XHCI Instance.
DeviceAddressThe target device address.
EndPointAddressEndpoint number and its direction encoded in bit 7
DeviceSpeedTarget device speed.
MaximumPacketLengthMaximum packet size the default control transfer endpoint is capable of sending or receiving.
TypeThe transaction type.
RequestUSB device request to send.
DataData buffer to be transmitted or received from USB device.
DataLengthThe size (in bytes) of the data buffer.
TimeoutIndicates the maximum timeout, in millisecond.
TransferResultReturn the result of this control transfer.
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 767 of file Xhci.c.

Variable Documentation

◆ gXhciDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding
Initial value:
= {
0x30,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI XhcDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Xhci.c:1725
EFI_STATUS EFIAPI XhcDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: Xhci.c:1963
EFI_STATUS EFIAPI XhcDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: Xhci.c:2205

Definition at line 59 of file Xhci.c.

◆ gXhciUsb2HcTemplate

EFI_USB2_HC_PROTOCOL gXhciUsb2HcTemplate
Initial value:
= {
0x3,
0x0
}
EFI_STATUS EFIAPI XhcSetRootHubPortFeature(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
Definition: Xhci.c:510
EFI_STATUS EFIAPI XhcReset(IN EFI_USB2_HC_PROTOCOL *This, IN UINT16 Attributes)
Definition: Xhci.c:151
EFI_STATUS EFIAPI XhcAsyncIsochronousTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack, IN VOID *Context)
Definition: Xhci.c:1666
EFI_STATUS EFIAPI XhcControlTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION TransferDirection, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
Definition: Xhci.c:870
EFI_STATUS EFIAPI XhcGetRootHubPortStatus(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
Definition: Xhci.c:368
EFI_STATUS EFIAPI XhcSetState(IN EFI_USB2_HC_PROTOCOL *This, IN EFI_USB_HC_STATE State)
Definition: Xhci.c:290
EFI_STATUS EFIAPI XhcClearRootHubPortFeature(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
Definition: Xhci.c:626
EFI_STATUS EFIAPI XhcGetCapability(IN EFI_USB2_HC_PROTOCOL *This, OUT UINT8 *MaxSpeed, OUT UINT8 *PortNumber, OUT UINT8 *Is64BitCapable)
Definition: Xhci.c:109
EFI_STATUS EFIAPI XhcIsochronousTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
Definition: Xhci.c:1625
EFI_STATUS EFIAPI XhcAsyncInterruptTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN BOOLEAN IsNewTransfer, IN OUT UINT8 *DataToggle, IN UINTN PollingInterval, IN UINTN DataLength, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, IN VOID *Context OPTIONAL)
Definition: Xhci.c:1377
EFI_STATUS EFIAPI XhcGetState(IN EFI_USB2_HC_PROTOCOL *This, OUT EFI_USB_HC_STATE *State)
Definition: Xhci.c:248
EFI_STATUS EFIAPI XhcSyncInterruptTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
Definition: Xhci.c:1519
EFI_STATUS EFIAPI XhcBulkTransfer(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, IN UINT8 DataBuffersNumber, IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN Timeout, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, OUT UINT32 *TransferResult)
Definition: Xhci.c:1250

Definition at line 71 of file Xhci.c.

◆ mUsbClearPortChangeMap

USB_CLEAR_PORT_MAP mUsbClearPortChangeMap[]
Initial value:
= {
{ XHC_PORTSC_CSC, EfiUsbPortConnectChange },
{ XHC_PORTSC_PEC, EfiUsbPortEnableChange },
{ XHC_PORTSC_OCC, EfiUsbPortOverCurrentChange },
{ XHC_PORTSC_PRC, EfiUsbPortResetChange }
}

Definition at line 30 of file Xhci.c.

◆ mUsbHubClearPortChangeMap

USB_CLEAR_PORT_MAP mUsbHubClearPortChangeMap[]
Initial value:
= {
{ XHC_HUB_PORTSC_CSC, EfiUsbPortConnectChange },
{ XHC_HUB_PORTSC_PEC, EfiUsbPortEnableChange },
{ XHC_HUB_PORTSC_OCC, EfiUsbPortOverCurrentChange },
{ XHC_HUB_PORTSC_PRC, EfiUsbPortResetChange },
{ XHC_HUB_PORTSC_BHRC, Usb3PortBHPortResetChange }
}

Definition at line 51 of file Xhci.c.

◆ mUsbHubPortChangeMap

USB_PORT_STATE_MAP mUsbHubPortChangeMap[]
Initial value:
= {
{ XHC_HUB_PORTSC_CSC, USB_PORT_STAT_C_CONNECTION },
{ XHC_HUB_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
{ XHC_HUB_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
{ XHC_HUB_PORTSC_PRC, USB_PORT_STAT_C_RESET }
}
#define USB_PORT_STAT_C_CONNECTION

Definition at line 44 of file Xhci.c.

◆ mUsbHubPortStateMap

USB_PORT_STATE_MAP mUsbHubPortStateMap[]
Initial value:
= {
{ XHC_HUB_PORTSC_CCS, USB_PORT_STAT_CONNECTION },
{ XHC_HUB_PORTSC_PED, USB_PORT_STAT_ENABLE },
{ XHC_HUB_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
{ XHC_HUB_PORTSC_RESET, USB_PORT_STAT_RESET }
}
#define USB_PORT_STAT_CONNECTION

Definition at line 37 of file Xhci.c.

◆ mUsbPortChangeMap

USB_PORT_STATE_MAP mUsbPortChangeMap[]
Initial value:
= {
{ XHC_PORTSC_CSC, USB_PORT_STAT_C_CONNECTION },
{ XHC_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
{ XHC_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
{ XHC_PORTSC_PRC, USB_PORT_STAT_C_RESET }
}

Definition at line 23 of file Xhci.c.

◆ mUsbPortStateMap

USB_PORT_STATE_MAP mUsbPortStateMap[]
Initial value:
= {
{ XHC_PORTSC_CCS, USB_PORT_STAT_CONNECTION },
{ XHC_PORTSC_PED, USB_PORT_STAT_ENABLE },
{ XHC_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
{ XHC_PORTSC_RESET, USB_PORT_STAT_RESET }
}

Definition at line 16 of file Xhci.c.