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

Go to the source code of this file.

Functions

URBXhcCreateCmdTrb (IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *CmdTrb)
 
EFI_STATUS EFIAPI XhcCmdTransfer (IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *CmdTrb, IN UINTN Timeout, OUT TRB_TEMPLATE **EvtTrb)
 
URBXhcCreateUrb (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN UINTN Type, IN EFI_USB_DEVICE_REQUEST *Request, IN VOID *Data, IN UINTN DataLen, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context)
 
VOID XhcFreeUrb (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
EFI_STATUS XhcCreateTransferTrb (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
VOID XhcInitSched (IN USB_XHCI_INSTANCE *Xhc)
 
EFI_STATUS EFIAPI XhcRecoverHaltedEndpoint (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
EFI_STATUS EFIAPI XhcDequeueTrbFromEndpoint (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
VOID CreateEventRing (IN USB_XHCI_INSTANCE *Xhc, OUT EVENT_RING *EventRing)
 
VOID CreateTransferRing (IN USB_XHCI_INSTANCE *Xhc, IN UINTN TrbNum, OUT TRANSFER_RING *TransferRing)
 
EFI_STATUS EFIAPI XhcFreeEventRing (IN USB_XHCI_INSTANCE *Xhc, IN EVENT_RING *EventRing)
 
VOID XhcFreeSched (IN USB_XHCI_INSTANCE *Xhc)
 
BOOLEAN IsTransferRingTrb (IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, IN URB *Urb)
 
BOOLEAN IsAsyncIntTrb (IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, OUT URB **Urb)
 
BOOLEAN XhcCheckUrbResult (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
EFI_STATUS XhcExecTransfer (IN USB_XHCI_INSTANCE *Xhc, IN BOOLEAN CmdTransfer, IN URB *Urb, IN UINTN Timeout)
 
EFI_STATUS XhciDelAsyncIntTransfer (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusAddr, IN UINT8 EpNum)
 
VOID XhciDelAllAsyncIntTransfers (IN USB_XHCI_INSTANCE *Xhc)
 
URBXhciInsertAsyncIntTransfer (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINTN MaxPacket, IN UINTN DataLen, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context)
 
VOID XhcUpdateAsyncRequest (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
EFI_STATUS XhcFlushAsyncIntMap (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
VOID EFIAPI XhcMonitorAsyncRequests (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI XhcPollPortStatusChange (IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT8 Port, IN EFI_USB_PORT_STATUS *PortState)
 
UINT8 XhcEndpointToDci (IN UINT8 EpAddr, IN UINT8 Direction)
 
UINT8 EFIAPI XhcBusDevAddrToSlotId (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusDevAddr)
 
UINT8 EFIAPI XhcRouteStringToSlotId (IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE RouteString)
 
EFI_STATUS EFIAPI XhcSyncEventRing (IN USB_XHCI_INSTANCE *Xhc, IN EVENT_RING *EvtRing)
 
EFI_STATUS EFIAPI XhcSyncTrsRing (IN USB_XHCI_INSTANCE *Xhc, IN TRANSFER_RING *TrsRing)
 
EFI_STATUS EFIAPI XhcCheckNewEvent (IN USB_XHCI_INSTANCE *Xhc, IN EVENT_RING *EvtRing, OUT TRB_TEMPLATE **NewEvtTrb)
 
EFI_STATUS EFIAPI XhcRingDoorBell (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
 
EFI_STATUS RingIntTransferDoorBell (IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
 
VOID XhcCmdRingCmdAbort (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId)
 
EFI_STATUS EFIAPI XhcInitializeDeviceSlot (IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT16 ParentPort, IN USB_DEV_ROUTE RouteChart, IN UINT8 DeviceSpeed)
 
EFI_STATUS EFIAPI XhcInitializeDeviceSlot64 (IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT16 ParentPort, IN USB_DEV_ROUTE RouteChart, IN UINT8 DeviceSpeed)
 
EFI_STATUS EFIAPI XhcDisableSlotCmd (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId)
 
EFI_STATUS EFIAPI XhcDisableSlotCmd64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId)
 
UINT8 EFIAPI XhcInitializeEndpointContext (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN INPUT_CONTEXT *InputContext, IN USB_INTERFACE_DESCRIPTOR *IfDesc)
 
UINT8 EFIAPI XhcInitializeEndpointContext64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN INPUT_CONTEXT_64 *InputContext, IN USB_INTERFACE_DESCRIPTOR *IfDesc)
 
EFI_STATUS EFIAPI XhcSetConfigCmd (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
 
EFI_STATUS EFIAPI XhcSetConfigCmd64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
 
EFI_STATUS EFIAPI XhcStopEndpoint (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *PendingUrb OPTIONAL)
 
EFI_STATUS EFIAPI XhcResetEndpoint (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
 
EFI_STATUS EFIAPI XhcSetTrDequeuePointer (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *Urb)
 
EFI_STATUS EFIAPI XhcSetInterface (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc, IN EFI_USB_DEVICE_REQUEST *Request)
 
EFI_STATUS EFIAPI XhcSetInterface64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc, IN EFI_USB_DEVICE_REQUEST *Request)
 
EFI_STATUS EFIAPI XhcEvaluateContext (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
 
EFI_STATUS EFIAPI XhcEvaluateContext64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
 
EFI_STATUS XhcConfigHubContext (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
 
EFI_STATUS XhcConfigHubContext64 (IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
 

Detailed Description

XHCI transfer scheduling routines.

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

Definition in file XhciSched.c.

Function Documentation

◆ CreateEventRing()

VOID CreateEventRing ( IN USB_XHCI_INSTANCE Xhc,
OUT EVENT_RING EventRing 
)

Create XHCI event ring.

Parameters
XhcThe XHCI Instance.
EventRingThe created event ring.

Definition at line 789 of file XhciSched.c.

◆ CreateTransferRing()

VOID CreateTransferRing ( IN USB_XHCI_INSTANCE Xhc,
IN UINTN  TrbNum,
OUT TRANSFER_RING TransferRing 
)

Create XHCI transfer ring.

Parameters
XhcThe XHCI Instance.
TrbNumThe number of TRB in the ring.
TransferRingThe created transfer ring.

Definition at line 890 of file XhciSched.c.

◆ IsAsyncIntTrb()

BOOLEAN IsAsyncIntTrb ( IN USB_XHCI_INSTANCE Xhc,
IN TRB_TEMPLATE Trb,
OUT URB **  Urb 
)

Check if the Trb is a transaction of the URBs in XHCI's asynchronous transfer list.

Parameters
XhcThe XHCI Instance.
TrbThe TRB to be checked.
UrbThe pointer to the matched Urb.
Return values
TRUEThe Trb is matched with a transaction of the URBs in the async list.
FALSEThe Trb is not matched with any URBs in the async list.

Definition at line 1069 of file XhciSched.c.

◆ IsTransferRingTrb()

BOOLEAN IsTransferRingTrb ( IN USB_XHCI_INSTANCE Xhc,
IN TRB_TEMPLATE Trb,
IN URB Urb 
)

Check if the Trb is a transaction of the URB.

Parameters
XhcThe XHCI Instance.
TrbThe TRB to be checked
UrbThe URB to be checked.
Return values
TRUEIt is a transaction of the URB.
FALSEIt is not any transaction of the URB.

Definition at line 1024 of file XhciSched.c.

◆ RingIntTransferDoorBell()

EFI_STATUS RingIntTransferDoorBell ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Ring the door bell to notify XHCI there is a transaction to be executed through URB.

Parameters
XhcThe XHCI Instance.
UrbThe URB to be rung.
Return values
EFI_SUCCESSSuccessfully ring the door bell.

Definition at line 2099 of file XhciSched.c.

◆ XhcBusDevAddrToSlotId()

UINT8 EFIAPI XhcBusDevAddrToSlotId ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  BusDevAddr 
)

Find out the actual device address according to the requested device address from UsbBus.

Parameters
XhcThe XHCI Instance.
BusDevAddrThe requested device address by UsbBus upper driver.
Returns
The actual device address assigned to the device.

Definition at line 1853 of file XhciSched.c.

◆ XhcCheckNewEvent()

EFI_STATUS EFIAPI XhcCheckNewEvent ( IN USB_XHCI_INSTANCE Xhc,
IN EVENT_RING EvtRing,
OUT TRB_TEMPLATE **  NewEvtTrb 
)

Check if there is a new generated event.

Parameters
XhcThe XHCI Instance.
EvtRingThe event ring to check.
NewEvtTrbThe new event TRB found.
Return values
EFI_SUCCESSFound a new event TRB at the event ring.
EFI_NOT_READYThe event ring has no new event.

Definition at line 2037 of file XhciSched.c.

◆ XhcCheckUrbResult()

BOOLEAN XhcCheckUrbResult ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Check the URB's execution result and update the URB's result accordingly.

Parameters
XhcThe XHCI Instance.
UrbThe URB to check result.
Returns
Whether the result of URB transfer is finialized.

Definition at line 1101 of file XhciSched.c.

◆ XhcCmdRingCmdAbort()

VOID XhcCmdRingCmdAbort ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId 
)

Set Command abort

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be disabled.

Definition at line 2121 of file XhciSched.c.

◆ XhcCmdTransfer()

EFI_STATUS EFIAPI XhcCmdTransfer ( IN USB_XHCI_INSTANCE Xhc,
IN TRB_TEMPLATE CmdTrb,
IN UINTN  Timeout,
OUT TRB_TEMPLATE **  EvtTrb 
)

Execute a XHCI cmd TRB pointed by CmdTrb.

Parameters
XhcThe XHCI Instance.
CmdTrbThe cmd TRB to be executed.
TimeoutIndicates the maximum time, in millisecond, which the transfer is allowed to complete.
EvtTrbThe event TRB corresponding to the cmd TRB.
Return values
EFI_SUCCESSThe transfer was completed successfully.
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 67 of file XhciSched.c.

◆ XhcConfigHubContext()

EFI_STATUS XhcConfigHubContext ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  PortNum,
IN UINT8  TTT,
IN UINT8  MTT 
)

Evaluate the slot context for hub device through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
PortNumThe total number of downstream port supported by the hub.
TTTThe TT think time of the hub device.
MTTThe multi-TT of the hub device.
Return values
EFI_SUCCESSSuccessfully configure the hub device's slot context.

Definition at line 4134 of file XhciSched.c.

◆ XhcConfigHubContext64()

EFI_STATUS XhcConfigHubContext64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  PortNum,
IN UINT8  TTT,
IN UINT8  MTT 
)

Evaluate the slot context for hub device through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
PortNumThe total number of downstream port supported by the hub.
TTTThe TT think time of the hub device.
MTTThe multi-TT of the hub device.
Return values
EFI_SUCCESSSuccessfully configure the hub device's slot context.

Definition at line 4204 of file XhciSched.c.

◆ XhcCreateCmdTrb()

URB * XhcCreateCmdTrb ( IN USB_XHCI_INSTANCE Xhc,
IN TRB_TEMPLATE CmdTrb 
)

Create a command transfer TRB to support XHCI command interfaces.

Parameters
XhcThe XHCI Instance.
CmdTrbThe cmd TRB to be executed.
Returns
Created URB or NULL.

Definition at line 25 of file XhciSched.c.

◆ XhcCreateTransferTrb()

EFI_STATUS XhcCreateTransferTrb ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Create a transfer TRB.

Parameters
XhcThe XHCI Instance
UrbThe urb used to construct the transfer TRB.
Returns
Created TRB or NULL

Definition at line 218 of file XhciSched.c.

◆ XhcCreateUrb()

URB * XhcCreateUrb ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  BusAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN UINTN  Type,
IN EFI_USB_DEVICE_REQUEST Request,
IN VOID *  Data,
IN UINTN  DataLen,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *  Context 
)

Create a new URB for a new transaction.

Parameters
XhcThe XHCI Instance
BusAddrThe logical device address assigned by UsbBus driver
EpAddrEndpoint addrress
DevSpeedThe device speed
MaxPacketThe max packet length of the endpoint
TypeThe transaction type
RequestThe standard USB request for control transfer
DataThe user data to transfer
DataLenThe length of data buffer
CallbackThe function to call when data is transferred
ContextThe context to the callback
Returns
Created URB or NULL

Definition at line 134 of file XhciSched.c.

◆ XhcDequeueTrbFromEndpoint()

EFI_STATUS EFIAPI XhcDequeueTrbFromEndpoint ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

System software shall use a Stop Endpoint Command (section 4.6.9) and the Set TR Dequeue Pointer Command (section 4.6.10) to remove the timed-out TDs from the xHC transfer ring. The next write to the Doorbell of the Endpoint will transition the Endpoint Context from the Stopped to the Running state.

Parameters
XhcThe XHCI Instance.
UrbThe urb which doesn't get completed in a specified timeout range.
Return values
EFI_SUCCESSThe dequeuing of the TDs is successful.
EFI_ALREADY_STARTEDThe Urb is finished so no deque is needed.
OthersFailed to stop the endpoint and dequeue the TDs.

Definition at line 724 of file XhciSched.c.

◆ XhcDisableSlotCmd()

EFI_STATUS EFIAPI XhcDisableSlotCmd ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId 
)

Disable the specified device slot.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be disabled.
Return values
EFI_SUCCESSSuccessfully disable the device slot.

Definition at line 2596 of file XhciSched.c.

◆ XhcDisableSlotCmd64()

EFI_STATUS EFIAPI XhcDisableSlotCmd64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId 
)

Disable the specified device slot.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be disabled.
Return values
EFI_SUCCESSSuccessfully disable the device slot.

Definition at line 2709 of file XhciSched.c.

◆ XhcEndpointToDci()

UINT8 XhcEndpointToDci ( IN UINT8  EpAddr,
IN UINT8  Direction 
)

Calculate the device context index by endpoint address and direction.

Parameters
EpAddrThe target endpoint number.
DirectionThe direction of the target endpoint.
Returns
The device context index of endpoint.

Definition at line 1823 of file XhciSched.c.

◆ XhcEvaluateContext()

EFI_STATUS EFIAPI XhcEvaluateContext ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT32  MaxPacketSize 
)

Evaluate the endpoint 0 context through XHCI's Evaluate_Context cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be evaluated.
MaxPacketSizeThe max packet size supported by the device control transfer.
Return values
EFI_SUCCESSSuccessfully evaluate the device endpoint 0.

Definition at line 4007 of file XhciSched.c.

◆ XhcEvaluateContext64()

EFI_STATUS EFIAPI XhcEvaluateContext64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT32  MaxPacketSize 
)

Evaluate the endpoint 0 context through XHCI's Evaluate_Context cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be evaluated.
MaxPacketSizeThe max packet size supported by the device control transfer.
Return values
EFI_SUCCESSSuccessfully evaluate the device endpoint 0.

Definition at line 4070 of file XhciSched.c.

◆ XhcExecTransfer()

EFI_STATUS XhcExecTransfer ( IN USB_XHCI_INSTANCE Xhc,
IN BOOLEAN  CmdTransfer,
IN URB Urb,
IN UINTN  Timeout 
)

Execute the transfer by polling the URB. This is a synchronous operation.

Parameters
XhcThe XHCI Instance.
CmdTransferThe executed URB is for cmd transfer or not.
UrbThe URB to execute.
TimeoutThe time to wait before abort, in millisecond.
Returns
EFI_DEVICE_ERROR The transfer failed due to transfer error.
EFI_TIMEOUT The transfer failed due to time out.
EFI_SUCCESS The transfer finished OK.

Definition at line 1294 of file XhciSched.c.

◆ XhcFlushAsyncIntMap()

EFI_STATUS XhcFlushAsyncIntMap ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Flush data from PCI controller specific address to mapped system memory address.

Parameters
XhcThe XHCI device.
UrbThe URB to unmap.
Return values
EFI_SUCCESSSuccess to flush data to mapped system memory.
EFI_DEVICE_ERRORFail to flush data to mapped system memory.

Definition at line 1562 of file XhciSched.c.

◆ XhcFreeEventRing()

EFI_STATUS EFIAPI XhcFreeEventRing ( IN USB_XHCI_INSTANCE Xhc,
IN EVENT_RING EventRing 
)

Free XHCI event ring.

Parameters
XhcThe XHCI Instance.
EventRingThe event ring to be freed.

Definition at line 939 of file XhciSched.c.

◆ XhcFreeSched()

VOID XhcFreeSched ( IN USB_XHCI_INSTANCE Xhc)

Free the resouce allocated at initializing schedule.

Parameters
XhcThe XHCI Instance.

Definition at line 967 of file XhciSched.c.

◆ XhcFreeUrb()

VOID XhcFreeUrb ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Free an allocated URB.

Parameters
XhcThe XHCI device.
UrbThe URB to free.

Definition at line 192 of file XhciSched.c.

◆ XhciDelAllAsyncIntTransfers()

VOID XhciDelAllAsyncIntTransfers ( IN USB_XHCI_INSTANCE Xhc)

Remove all the asynchronous interrutp transfers.

Parameters
XhcThe XHCI Instance.

Definition at line 1430 of file XhciSched.c.

◆ XhciDelAsyncIntTransfer()

EFI_STATUS XhciDelAsyncIntTransfer ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  BusAddr,
IN UINT8  EpNum 
)

Delete a single asynchronous interrupt transfer for the device and endpoint.

Parameters
XhcThe XHCI Instance.
BusAddrThe logical device address assigned by UsbBus driver.
EpNumThe endpoint of the target.
Return values
EFI_SUCCESSAn asynchronous transfer is removed.
EFI_NOT_FOUNDNo transfer for the device is found.

Definition at line 1381 of file XhciSched.c.

◆ XhciInsertAsyncIntTransfer()

URB * XhciInsertAsyncIntTransfer ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  BusAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINTN  MaxPacket,
IN UINTN  DataLen,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *  Context 
)

Insert a single asynchronous interrupt transfer for the device and endpoint.

Parameters
XhcThe XHCI Instance
BusAddrThe logical device address assigned by UsbBus driver
EpAddrEndpoint addrress
DevSpeedThe device speed
MaxPacketThe max packet length of the endpoint
DataLenThe length of data buffer
CallbackThe function to call when data is transferred
ContextThe context to the callback
Returns
Created URB or NULL

Definition at line 1474 of file XhciSched.c.

◆ XhcInitializeDeviceSlot()

EFI_STATUS EFIAPI XhcInitializeDeviceSlot ( IN USB_XHCI_INSTANCE Xhc,
IN USB_DEV_ROUTE  ParentRouteChart,
IN UINT16  ParentPort,
IN USB_DEV_ROUTE  RouteChart,
IN UINT8  DeviceSpeed 
)

Assign and initialize the device slot for a new device.

Parameters
XhcThe XHCI Instance.
ParentRouteChartThe route string pointed to the parent device.
ParentPortThe port at which the device is located.
RouteChartThe route string pointed to the device.
DeviceSpeedThe device speed.
Return values
EFI_SUCCESSSuccessfully assign a slot to the device and assign an address to it.

Definition at line 2147 of file XhciSched.c.

◆ XhcInitializeDeviceSlot64()

EFI_STATUS EFIAPI XhcInitializeDeviceSlot64 ( IN USB_XHCI_INSTANCE Xhc,
IN USB_DEV_ROUTE  ParentRouteChart,
IN UINT16  ParentPort,
IN USB_DEV_ROUTE  RouteChart,
IN UINT8  DeviceSpeed 
)

Assign and initialize the device slot for a new device.

Parameters
XhcThe XHCI Instance.
ParentRouteChartThe route string pointed to the parent device.
ParentPortThe port at which the device is located.
RouteChartThe route string pointed to the device.
DeviceSpeedThe device speed.
Return values
EFI_SUCCESSSuccessfully assign a slot to the device and assign an address to it.

Definition at line 2373 of file XhciSched.c.

◆ XhcInitializeEndpointContext()

UINT8 EFIAPI XhcInitializeEndpointContext ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN INPUT_CONTEXT InputContext,
IN USB_INTERFACE_DESCRIPTOR IfDesc 
)

Initialize endpoint context in input context.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
InputContextThe pointer to the input context.
IfDescThe pointer to the usb device interface descriptor.
Returns
The maximum device context index of endpoint.

Definition at line 2825 of file XhciSched.c.

◆ XhcInitializeEndpointContext64()

UINT8 EFIAPI XhcInitializeEndpointContext64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN INPUT_CONTEXT_64 InputContext,
IN USB_INTERFACE_DESCRIPTOR IfDesc 
)

Initialize endpoint context in input context.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
InputContextThe pointer to the input context.
IfDescThe pointer to the usb device interface descriptor.
Returns
The maximum device context index of endpoint.

Definition at line 3028 of file XhciSched.c.

◆ XhcInitSched()

VOID XhcInitSched ( IN USB_XHCI_INSTANCE Xhc)

Initialize the XHCI host controller for schedule.

Parameters
XhcThe XHCI Instance to be initialized.

Definition at line 475 of file XhciSched.c.

◆ XhcMonitorAsyncRequests()

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

Interrupt transfer periodic check handler.

Parameters
EventInterrupt event.
ContextPointer to USB_XHCI_INSTANCE.

Definition at line 1614 of file XhciSched.c.

◆ XhcPollPortStatusChange()

EFI_STATUS EFIAPI XhcPollPortStatusChange ( IN USB_XHCI_INSTANCE Xhc,
IN USB_DEV_ROUTE  ParentRouteChart,
IN UINT8  Port,
IN EFI_USB_PORT_STATUS PortState 
)

Monitor the port status change. Enable/Disable device slot if there is a device attached/detached.

Parameters
XhcThe XHCI Instance.
ParentRouteChartThe route string pointed to the parent device if it exists.
PortThe port to be polled.
PortStateThe port state.
Return values
EFI_SUCCESSSuccessfully enable/disable device slot according to port state.
OthersShould not appear.

Definition at line 1727 of file XhciSched.c.

◆ XhcRecoverHaltedEndpoint()

EFI_STATUS EFIAPI XhcRecoverHaltedEndpoint ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

System software shall use a Reset Endpoint Command (section 4.11.4.7) to remove the Halted condition in the xHC. After the successful completion of the Reset Endpoint Command, the Endpoint Context is transitioned from the Halted to the Stopped state and the Transfer Ring of the endpoint is reenabled. The next write to the Doorbell of the Endpoint will transition the Endpoint Context from the Stopped to the Running state.

Parameters
XhcThe XHCI Instance.
UrbThe urb which makes the endpoint halted.
Return values
EFI_SUCCESSThe recovery is successful.
OthersFailed to recovery halted endpoint.

Definition at line 661 of file XhciSched.c.

◆ XhcResetEndpoint()

EFI_STATUS EFIAPI XhcResetEndpoint ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  Dci 
)

Reset endpoint through XHCI's Reset_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DciThe device context index of endpoint.
Return values
EFI_SUCCESSReset endpoint successfully.
OthersFailed to reset endpoint.

Definition at line 3491 of file XhciSched.c.

◆ XhcRingDoorBell()

EFI_STATUS EFIAPI XhcRingDoorBell ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  Dci 
)

Ring the door bell to notify XHCI there is a transaction to be executed.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id of the target device.
DciThe device context index of the target slot or endpoint.
Return values
EFI_SUCCESSSuccessfully ring the door bell.

Definition at line 2074 of file XhciSched.c.

◆ XhcRouteStringToSlotId()

UINT8 EFIAPI XhcRouteStringToSlotId ( IN USB_XHCI_INSTANCE Xhc,
IN USB_DEV_ROUTE  RouteString 
)

Find out the slot id according to the device's route string.

Parameters
XhcThe XHCI Instance.
RouteStringThe route string described the device location.
Returns
The slot id used by the device.

Definition at line 1887 of file XhciSched.c.

◆ XhcSetConfigCmd()

EFI_STATUS EFIAPI XhcSetConfigCmd ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN USB_CONFIG_DESCRIPTOR ConfigDesc 
)

Configure all the device endpoints through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
ConfigDescThe pointer to the usb device configuration descriptor.
Return values
EFI_SUCCESSSuccessfully configure all the device endpoints.

Definition at line 3230 of file XhciSched.c.

◆ XhcSetConfigCmd64()

EFI_STATUS EFIAPI XhcSetConfigCmd64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN USB_CONFIG_DESCRIPTOR ConfigDesc 
)

Configure all the device endpoints through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
ConfigDescThe pointer to the usb device configuration descriptor.
Return values
EFI_SUCCESSSuccessfully configure all the device endpoints.

Definition at line 3323 of file XhciSched.c.

◆ XhcSetInterface()

EFI_STATUS EFIAPI XhcSetInterface ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN USB_CONFIG_DESCRIPTOR ConfigDesc,
IN EFI_USB_DEVICE_REQUEST Request 
)

Set interface through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
ConfigDescThe pointer to the usb device configuration descriptor.
RequestUSB device request to send.
Return values
EFI_SUCCESSSuccessfully set interface.

Definition at line 3595 of file XhciSched.c.

◆ XhcSetInterface64()

EFI_STATUS EFIAPI XhcSetInterface64 ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  DeviceSpeed,
IN USB_CONFIG_DESCRIPTOR ConfigDesc,
IN EFI_USB_DEVICE_REQUEST Request 
)

Set interface through XHCI's Configure_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DeviceSpeedThe device's speed.
ConfigDescThe pointer to the usb device configuration descriptor.
RequestUSB device request to send.
Return values
EFI_SUCCESSSuccessfully set interface.

Definition at line 3802 of file XhciSched.c.

◆ XhcSetTrDequeuePointer()

EFI_STATUS EFIAPI XhcSetTrDequeuePointer ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  Dci,
IN URB Urb 
)

Set transfer ring dequeue pointer through XHCI's Set_Tr_Dequeue_Pointer cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DciThe device context index of endpoint.
UrbThe dequeue pointer of the transfer ring specified by the urb to be updated.
Return values
EFI_SUCCESSSet transfer ring dequeue pointer succeeds.
OthersFailed to set transfer ring dequeue pointer.

Definition at line 3541 of file XhciSched.c.

◆ XhcStopEndpoint()

EFI_STATUS EFIAPI XhcStopEndpoint ( IN USB_XHCI_INSTANCE Xhc,
IN UINT8  SlotId,
IN UINT8  Dci,
IN URB *PendingUrb  OPTIONAL 
)

Stop endpoint through XHCI's Stop_Endpoint cmd.

Parameters
XhcThe XHCI Instance.
SlotIdThe slot id to be configured.
DciThe device context index of endpoint.
PendingUrbThe pending URB to check completion status when stopping the end point.
Return values
EFI_SUCCESSStop endpoint successfully.
OthersFailed to stop endpoint.

Definition at line 3417 of file XhciSched.c.

◆ XhcSyncEventRing()

EFI_STATUS EFIAPI XhcSyncEventRing ( IN USB_XHCI_INSTANCE Xhc,
IN EVENT_RING EvtRing 
)

Synchronize the specified event ring to update the enqueue and dequeue pointer.

Parameters
XhcThe XHCI Instance.
EvtRingThe event ring to sync.
Return values
EFI_SUCCESSThe event ring is synchronized successfully.

Definition at line 1921 of file XhciSched.c.

◆ XhcSyncTrsRing()

EFI_STATUS EFIAPI XhcSyncTrsRing ( IN USB_XHCI_INSTANCE Xhc,
IN TRANSFER_RING TrsRing 
)

Synchronize the specified transfer ring to update the enqueue and dequeue pointer.

Parameters
XhcThe XHCI Instance.
TrsRingThe transfer ring to sync.
Return values
EFI_SUCCESSThe transfer ring is synchronized successfully.

Definition at line 1970 of file XhciSched.c.

◆ XhcUpdateAsyncRequest()

VOID XhcUpdateAsyncRequest ( IN USB_XHCI_INSTANCE Xhc,
IN URB Urb 
)

Update the queue head for next round of asynchronous transfer

Parameters
XhcThe XHCI Instance.
UrbThe URB to update

Definition at line 1530 of file XhciSched.c.