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

Go to the source code of this file.

Data Structures

struct  _USB_DEV_TOPOLOGY
 
union  _USB_DEV_ROUTE
 
struct  _USB_ENDPOINT
 
struct  _TRB_TEMPLATE
 
struct  _TRANSFER_RING
 
struct  _EVENT_RING
 
struct  _URB
 
struct  _EVENT_RING_SEG_TABLE_ENTRY
 
struct  _TRANSFER_TRB_NORMAL
 
struct  _TRANSFER_TRB_CONTROL_SETUP
 
struct  _TRANSFER_TRB_CONTROL_DATA
 
struct  _TRANSFER_TRB_CONTROL_STATUS
 
struct  _EVT_TRB_TRANSFER
 
struct  _EVT_TRB_COMMAND_COMPLETION
 
union  _TRB
 
struct  _CMD_TRB_NO_OP
 
struct  _CMD_TRB_ENABLE_SLOT
 
struct  _CMD_TRB_DISABLE_SLOT
 
struct  _CMD_TRB_ADDRESS_DEVICE
 
struct  _CMD_TRB_CONFIG_ENDPOINT
 
struct  _CMD_TRB_EVALUATE_CONTEXT
 
struct  _CMD_TRB_RESET_ENDPOINT
 
struct  _CMD_TRB_STOP_ENDPOINT
 
struct  _CMD_SET_TR_DEQ_POINTER
 
struct  _LINK_TRB
 
struct  _SLOT_CONTEXT
 
struct  _SLOT_CONTEXT_64
 
struct  _ENDPOINT_CONTEXT
 
struct  _ENDPOINT_CONTEXT_64
 
struct  _INPUT_CONTRL_CONTEXT
 
struct  _INPUT_CONTRL_CONTEXT_64
 
struct  _DEVICE_CONTEXT
 
struct  _DEVICE_CONTEXT_64
 
struct  _INPUT_CONTEXT
 
struct  _INPUT_CONTEXT_64
 

Macros

#define XHC_CTRL_TRANSFER   0x01
 
#define XHC_BULK_TRANSFER   0x02
 
#define TRB_TYPE_NORMAL   1
 
#define TRB_TYPE_SETUP_STAGE   2
 
#define TRB_TYPE_DATA_STAGE   3
 
#define TRB_TYPE_STATUS_STAGE   4
 
#define TRB_TYPE_ISOCH   5
 
#define TRB_TYPE_LINK   6
 
#define TRB_TYPE_EVENT_DATA   7
 
#define TRB_TYPE_NO_OP   8
 
#define TRB_TYPE_EN_SLOT   9
 
#define TRB_TYPE_DIS_SLOT   10
 
#define TRB_TYPE_ADDRESS_DEV   11
 
#define TRB_TYPE_CON_ENDPOINT   12
 
#define TRB_TYPE_EVALU_CONTXT   13
 
#define TRB_TYPE_RESET_ENDPOINT   14
 
#define TRB_TYPE_STOP_ENDPOINT   15
 
#define TRB_TYPE_SET_TR_DEQUE   16
 
#define TRB_TYPE_RESET_DEV   17
 
#define TRB_TYPE_GET_PORT_BANW   21
 
#define TRB_TYPE_FORCE_HEADER   22
 
#define TRB_TYPE_NO_OP_COMMAND   23
 
#define TRB_TYPE_TRANS_EVENT   32
 
#define TRB_TYPE_COMMAND_COMPLT_EVENT   33
 
#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT   34
 
#define TRB_TYPE_HOST_CONTROLLER_EVENT   37
 
#define TRB_TYPE_DEVICE_NOTIFI_EVENT   38
 
#define TRB_TYPE_MFINDEX_WRAP_EVENT   39
 
#define ED_NOT_VALID   0
 
#define ED_ISOCH_OUT   1
 
#define ED_BULK_OUT   2
 
#define ED_INTERRUPT_OUT   3
 
#define ED_CONTROL_BIDIR   4
 
#define ED_ISOCH_IN   5
 
#define ED_BULK_IN   6
 
#define ED_INTERRUPT_IN   7
 
#define TRB_COMPLETION_INVALID   0
 
#define TRB_COMPLETION_SUCCESS   1
 
#define TRB_COMPLETION_DATA_BUFFER_ERROR   2
 
#define TRB_COMPLETION_BABBLE_ERROR   3
 
#define TRB_COMPLETION_USB_TRANSACTION_ERROR   4
 
#define TRB_COMPLETION_TRB_ERROR   5
 
#define TRB_COMPLETION_STALL_ERROR   6
 
#define TRB_COMPLETION_SHORT_PACKET   13
 
#define XHC_URB_SIG   SIGNATURE_32 ('U', 'S', 'B', 'R')
 

Typedefs

typedef struct _USB_DEV_TOPOLOGY USB_DEV_TOPOLOGY
 
typedef union _USB_DEV_ROUTE USB_DEV_ROUTE
 
typedef struct _USB_ENDPOINT USB_ENDPOINT
 
typedef struct _TRB_TEMPLATE TRB_TEMPLATE
 
typedef struct _TRANSFER_RING TRANSFER_RING
 
typedef struct _EVENT_RING EVENT_RING
 
typedef struct _URB URB
 
typedef struct _EVENT_RING_SEG_TABLE_ENTRY EVENT_RING_SEG_TABLE_ENTRY
 
typedef struct _TRANSFER_TRB_NORMAL TRANSFER_TRB_NORMAL
 
typedef struct _TRANSFER_TRB_CONTROL_SETUP TRANSFER_TRB_CONTROL_SETUP
 
typedef struct _TRANSFER_TRB_CONTROL_DATA TRANSFER_TRB_CONTROL_DATA
 
typedef struct _TRANSFER_TRB_CONTROL_STATUS TRANSFER_TRB_CONTROL_STATUS
 
typedef struct _EVT_TRB_TRANSFER EVT_TRB_TRANSFER
 
typedef struct _EVT_TRB_COMMAND_COMPLETION EVT_TRB_COMMAND_COMPLETION
 
typedef union _TRB TRB
 
typedef struct _CMD_TRB_NO_OP CMD_TRB_NO_OP
 
typedef struct _CMD_TRB_ENABLE_SLOT CMD_TRB_ENABLE_SLOT
 
typedef struct _CMD_TRB_DISABLE_SLOT CMD_TRB_DISABLE_SLOT
 
typedef struct _CMD_TRB_ADDRESS_DEVICE CMD_TRB_ADDRESS_DEVICE
 
typedef struct _CMD_TRB_CONFIG_ENDPOINT CMD_TRB_CONFIG_ENDPOINT
 
typedef struct _CMD_TRB_EVALUATE_CONTEXT CMD_TRB_EVALUATE_CONTEXT
 
typedef struct _CMD_TRB_RESET_ENDPOINT CMD_TRB_RESET_ENDPOINT
 
typedef struct _CMD_TRB_STOP_ENDPOINT CMD_TRB_STOP_ENDPOINT
 
typedef struct _CMD_SET_TR_DEQ_POINTER CMD_SET_TR_DEQ_POINTER
 
typedef struct _LINK_TRB LINK_TRB
 
typedef struct _SLOT_CONTEXT SLOT_CONTEXT
 
typedef struct _SLOT_CONTEXT_64 SLOT_CONTEXT_64
 
typedef struct _ENDPOINT_CONTEXT ENDPOINT_CONTEXT
 
typedef struct _ENDPOINT_CONTEXT_64 ENDPOINT_CONTEXT_64
 
typedef struct _INPUT_CONTRL_CONTEXT INPUT_CONTRL_CONTEXT
 
typedef struct _INPUT_CONTRL_CONTEXT_64 INPUT_CONTRL_CONTEXT_64
 
typedef struct _DEVICE_CONTEXT DEVICE_CONTEXT
 
typedef struct _DEVICE_CONTEXT_64 DEVICE_CONTEXT_64
 
typedef struct _INPUT_CONTEXT INPUT_CONTEXT
 
typedef struct _INPUT_CONTEXT_64 INPUT_CONTEXT_64
 

Functions

EFI_STATUS XhcPeiExecTransfer (IN PEI_XHC_DEV *Xhc, IN BOOLEAN CmdTransfer, IN URB *Urb, IN UINTN Timeout)
 
UINT8 XhcPeiBusDevAddrToSlotId (IN PEI_XHC_DEV *Xhc, IN UINT8 BusDevAddr)
 
UINT8 XhcPeiRouteStringToSlotId (IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE RouteString)
 
UINT8 XhcPeiEndpointToDci (IN UINT8 EpAddr, IN EFI_USB_DATA_DIRECTION Direction)
 
VOID XhcPeiRingDoorBell (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
 
EFI_STATUS XhcPeiPollPortStatusChange (IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT8 Port, IN EFI_USB_PORT_STATUS *PortState)
 
EFI_STATUS XhcPeiConfigHubContext (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
 
EFI_STATUS XhcPeiConfigHubContext64 (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
 
EFI_STATUS XhcPeiSetConfigCmd (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
 
EFI_STATUS XhcPeiSetConfigCmd64 (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
 
EFI_STATUS EFIAPI XhcPeiStopEndpoint (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
 
EFI_STATUS EFIAPI XhcPeiResetEndpoint (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
 
EFI_STATUS EFIAPI XhcPeiSetTrDequeuePointer (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *Urb)
 
EFI_STATUS XhcPeiInitializeDeviceSlot (IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT16 ParentPort, IN USB_DEV_ROUTE RouteChart, IN UINT8 DeviceSpeed)
 
EFI_STATUS XhcPeiInitializeDeviceSlot64 (IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT16 ParentPort, IN USB_DEV_ROUTE RouteChart, IN UINT8 DeviceSpeed)
 
EFI_STATUS XhcPeiEvaluateContext (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
 
EFI_STATUS XhcPeiEvaluateContext64 (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
 
EFI_STATUS XhcPeiDisableSlotCmd (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId)
 
EFI_STATUS XhcPeiDisableSlotCmd64 (IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId)
 
EFI_STATUS XhcPeiRecoverHaltedEndpoint (IN PEI_XHC_DEV *Xhc, IN URB *Urb)
 
EFI_STATUS XhcPeiDequeueTrbFromEndpoint (IN PEI_XHC_DEV *Xhc, IN URB *Urb)
 
URBXhcPeiCreateUrb (IN PEI_XHC_DEV *Xhc, IN UINT8 DevAddr, 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 XhcPeiFreeUrb (IN PEI_XHC_DEV *Xhc, IN URB *Urb)
 
EFI_STATUS XhcPeiCreateTransferTrb (IN PEI_XHC_DEV *Xhc, IN URB *Urb)
 
EFI_STATUS XhcPeiSyncTrsRing (IN PEI_XHC_DEV *Xhc, IN TRANSFER_RING *TrsRing)
 
VOID XhcPeiCreateTransferRing (IN PEI_XHC_DEV *Xhc, IN UINTN TrbNum, OUT TRANSFER_RING *TransferRing)
 
EFI_STATUS XhcPeiCheckNewEvent (IN PEI_XHC_DEV *Xhc, IN EVENT_RING *EvtRing, OUT TRB_TEMPLATE **NewEvtTrb)
 
EFI_STATUS XhcPeiSyncEventRing (IN PEI_XHC_DEV *Xhc, IN EVENT_RING *EvtRing)
 
VOID XhcPeiCreateEventRing (IN PEI_XHC_DEV *Xhc, OUT EVENT_RING *EventRing)
 
VOID XhcPeiInitSched (IN PEI_XHC_DEV *Xhc)
 
VOID XhcPeiFreeSched (IN PEI_XHC_DEV *Xhc)
 

Detailed Description

Private Header file for Usb Host Controller PEIM

Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.

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

Definition in file XhciSched.h.

Macro Definition Documentation

◆ ED_BULK_IN

#define ED_BULK_IN   6

Definition at line 58 of file XhciSched.h.

◆ ED_BULK_OUT

#define ED_BULK_OUT   2

Definition at line 54 of file XhciSched.h.

◆ ED_CONTROL_BIDIR

#define ED_CONTROL_BIDIR   4

Definition at line 56 of file XhciSched.h.

◆ ED_INTERRUPT_IN

#define ED_INTERRUPT_IN   7

Definition at line 59 of file XhciSched.h.

◆ ED_INTERRUPT_OUT

#define ED_INTERRUPT_OUT   3

Definition at line 55 of file XhciSched.h.

◆ ED_ISOCH_IN

#define ED_ISOCH_IN   5

Definition at line 57 of file XhciSched.h.

◆ ED_ISOCH_OUT

#define ED_ISOCH_OUT   1

Definition at line 53 of file XhciSched.h.

◆ ED_NOT_VALID

#define ED_NOT_VALID   0

Definition at line 52 of file XhciSched.h.

◆ TRB_COMPLETION_BABBLE_ERROR

#define TRB_COMPLETION_BABBLE_ERROR   3

Definition at line 67 of file XhciSched.h.

◆ TRB_COMPLETION_DATA_BUFFER_ERROR

#define TRB_COMPLETION_DATA_BUFFER_ERROR   2

Definition at line 66 of file XhciSched.h.

◆ TRB_COMPLETION_INVALID

#define TRB_COMPLETION_INVALID   0

Definition at line 64 of file XhciSched.h.

◆ TRB_COMPLETION_SHORT_PACKET

#define TRB_COMPLETION_SHORT_PACKET   13

Definition at line 71 of file XhciSched.h.

◆ TRB_COMPLETION_STALL_ERROR

#define TRB_COMPLETION_STALL_ERROR   6

Definition at line 70 of file XhciSched.h.

◆ TRB_COMPLETION_SUCCESS

#define TRB_COMPLETION_SUCCESS   1

Definition at line 65 of file XhciSched.h.

◆ TRB_COMPLETION_TRB_ERROR

#define TRB_COMPLETION_TRB_ERROR   5

Definition at line 69 of file XhciSched.h.

◆ TRB_COMPLETION_USB_TRANSACTION_ERROR

#define TRB_COMPLETION_USB_TRANSACTION_ERROR   4

Definition at line 68 of file XhciSched.h.

◆ TRB_TYPE_ADDRESS_DEV

#define TRB_TYPE_ADDRESS_DEV   11

Definition at line 32 of file XhciSched.h.

◆ TRB_TYPE_COMMAND_COMPLT_EVENT

#define TRB_TYPE_COMMAND_COMPLT_EVENT   33

Definition at line 43 of file XhciSched.h.

◆ TRB_TYPE_CON_ENDPOINT

#define TRB_TYPE_CON_ENDPOINT   12

Definition at line 33 of file XhciSched.h.

◆ TRB_TYPE_DATA_STAGE

#define TRB_TYPE_DATA_STAGE   3

Definition at line 24 of file XhciSched.h.

◆ TRB_TYPE_DEVICE_NOTIFI_EVENT

#define TRB_TYPE_DEVICE_NOTIFI_EVENT   38

Definition at line 46 of file XhciSched.h.

◆ TRB_TYPE_DIS_SLOT

#define TRB_TYPE_DIS_SLOT   10

Definition at line 31 of file XhciSched.h.

◆ TRB_TYPE_EN_SLOT

#define TRB_TYPE_EN_SLOT   9

Definition at line 30 of file XhciSched.h.

◆ TRB_TYPE_EVALU_CONTXT

#define TRB_TYPE_EVALU_CONTXT   13

Definition at line 34 of file XhciSched.h.

◆ TRB_TYPE_EVENT_DATA

#define TRB_TYPE_EVENT_DATA   7

Definition at line 28 of file XhciSched.h.

◆ TRB_TYPE_FORCE_HEADER

#define TRB_TYPE_FORCE_HEADER   22

Definition at line 40 of file XhciSched.h.

◆ TRB_TYPE_GET_PORT_BANW

#define TRB_TYPE_GET_PORT_BANW   21

Definition at line 39 of file XhciSched.h.

◆ TRB_TYPE_HOST_CONTROLLER_EVENT

#define TRB_TYPE_HOST_CONTROLLER_EVENT   37

Definition at line 45 of file XhciSched.h.

◆ TRB_TYPE_ISOCH

#define TRB_TYPE_ISOCH   5

Definition at line 26 of file XhciSched.h.

◆ TRB_TYPE_LINK

#define TRB_TYPE_LINK   6

Definition at line 27 of file XhciSched.h.

◆ TRB_TYPE_MFINDEX_WRAP_EVENT

#define TRB_TYPE_MFINDEX_WRAP_EVENT   39

Definition at line 47 of file XhciSched.h.

◆ TRB_TYPE_NO_OP

#define TRB_TYPE_NO_OP   8

Definition at line 29 of file XhciSched.h.

◆ TRB_TYPE_NO_OP_COMMAND

#define TRB_TYPE_NO_OP_COMMAND   23

Definition at line 41 of file XhciSched.h.

◆ TRB_TYPE_NORMAL

#define TRB_TYPE_NORMAL   1

Definition at line 22 of file XhciSched.h.

◆ TRB_TYPE_PORT_STATUS_CHANGE_EVENT

#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT   34

Definition at line 44 of file XhciSched.h.

◆ TRB_TYPE_RESET_DEV

#define TRB_TYPE_RESET_DEV   17

Definition at line 38 of file XhciSched.h.

◆ TRB_TYPE_RESET_ENDPOINT

#define TRB_TYPE_RESET_ENDPOINT   14

Definition at line 35 of file XhciSched.h.

◆ TRB_TYPE_SET_TR_DEQUE

#define TRB_TYPE_SET_TR_DEQUE   16

Definition at line 37 of file XhciSched.h.

◆ TRB_TYPE_SETUP_STAGE

#define TRB_TYPE_SETUP_STAGE   2

Definition at line 23 of file XhciSched.h.

◆ TRB_TYPE_STATUS_STAGE

#define TRB_TYPE_STATUS_STAGE   4

Definition at line 25 of file XhciSched.h.

◆ TRB_TYPE_STOP_ENDPOINT

#define TRB_TYPE_STOP_ENDPOINT   15

Definition at line 36 of file XhciSched.h.

◆ TRB_TYPE_TRANS_EVENT

#define TRB_TYPE_TRANS_EVENT   32

Definition at line 42 of file XhciSched.h.

◆ XHC_BULK_TRANSFER

#define XHC_BULK_TRANSFER   0x02

Definition at line 17 of file XhciSched.h.

◆ XHC_CTRL_TRANSFER

#define XHC_CTRL_TRANSFER   0x01

Definition at line 16 of file XhciSched.h.

◆ XHC_URB_SIG

#define XHC_URB_SIG   SIGNATURE_32 ('U', 'S', 'B', 'R')

Definition at line 150 of file XhciSched.h.

Function Documentation

◆ XhcPeiBusDevAddrToSlotId()

UINT8 XhcPeiBusDevAddrToSlotId ( IN PEI_XHC_DEV Xhc,
IN UINT8  BusDevAddr 
)

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

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

Definition at line 979 of file XhciSched.c.

◆ XhcPeiCheckNewEvent()

EFI_STATUS XhcPeiCheckNewEvent ( IN PEI_XHC_DEV Xhc,
IN EVENT_RING EvtRing,
OUT TRB_TEMPLATE **  NewEvtTrb 
)

Check if there is a new generated event.

Parameters
XhcThe XHCI device.
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 2561 of file XhciSched.c.

◆ XhcPeiConfigHubContext()

EFI_STATUS XhcPeiConfigHubContext ( IN PEI_XHC_DEV 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 device.
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 2279 of file XhciSched.c.

◆ XhcPeiConfigHubContext64()

EFI_STATUS XhcPeiConfigHubContext64 ( IN PEI_XHC_DEV 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 device.
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 2348 of file XhciSched.c.

◆ XhcPeiCreateEventRing()

VOID XhcPeiCreateEventRing ( IN PEI_XHC_DEV Xhc,
OUT EVENT_RING EventRing 
)

Create XHCI event ring.

Parameters
XhcThe XHCI device.
EventRingThe created event ring.

Definition at line 2670 of file XhciSched.c.

◆ XhcPeiCreateTransferRing()

VOID XhcPeiCreateTransferRing ( IN PEI_XHC_DEV Xhc,
IN UINTN  TrbNum,
OUT TRANSFER_RING TransferRing 
)

Create XHCI transfer ring.

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

Definition at line 2835 of file XhciSched.c.

◆ XhcPeiCreateTransferTrb()

EFI_STATUS XhcPeiCreateTransferTrb ( IN PEI_XHC_DEV Xhc,
IN URB Urb 
)

Create a transfer TRB.

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

Definition at line 212 of file XhciSched.c.

◆ XhcPeiCreateUrb()

URB * XhcPeiCreateUrb ( IN PEI_XHC_DEV 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 device
DevAddrThe device address
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

Create a new URB for a new transaction.

Parameters
XhcThe XHCI device
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 131 of file XhciSched.c.

◆ XhcPeiDequeueTrbFromEndpoint()

EFI_STATUS XhcPeiDequeueTrbFromEndpoint ( IN PEI_XHC_DEV 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 device.
UrbThe urb which doesn't get completed in a specified timeout range.
Return values
EFI_SUCCESSThe dequeuing of the TDs is successful.
OthersFailed to stop the endpoint and dequeue the TDs.

Definition at line 532 of file XhciSched.c.

◆ XhcPeiDisableSlotCmd()

EFI_STATUS XhcPeiDisableSlotCmd ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId 
)

Disable the specified device slot.

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

Definition at line 1497 of file XhciSched.c.

◆ XhcPeiDisableSlotCmd64()

EFI_STATUS XhcPeiDisableSlotCmd64 ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId 
)

Disable the specified device slot.

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

Definition at line 1604 of file XhciSched.c.

◆ XhcPeiEndpointToDci()

UINT8 XhcPeiEndpointToDci ( IN UINT8  EpAddr,
IN EFI_USB_DATA_DIRECTION  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 948 of file XhciSched.c.

◆ XhcPeiEvaluateContext()

EFI_STATUS XhcPeiEvaluateContext ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId,
IN UINT32  MaxPacketSize 
)

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

Parameters
XhcThe XHCI device.
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 2167 of file XhciSched.c.

◆ XhcPeiEvaluateContext64()

EFI_STATUS XhcPeiEvaluateContext64 ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId,
IN UINT32  MaxPacketSize 
)

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

Parameters
XhcThe XHCI device.
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 2222 of file XhciSched.c.

◆ XhcPeiExecTransfer()

EFI_STATUS XhcPeiExecTransfer ( IN PEI_XHC_DEV 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 device.
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 797 of file XhciSched.c.

◆ XhcPeiFreeSched()

VOID XhcPeiFreeSched ( IN PEI_XHC_DEV Xhc)

Free the resouce allocated at initializing schedule.

Parameters
XhcThe XHCI device.

Definition at line 3049 of file XhciSched.c.

◆ XhcPeiFreeUrb()

VOID XhcPeiFreeUrb ( IN PEI_XHC_DEV Xhc,
IN URB Urb 
)

Free an allocated URB.

Parameters
XhcThe XHCI device.
UrbThe URB to free.

Definition at line 188 of file XhciSched.c.

◆ XhcPeiInitializeDeviceSlot()

EFI_STATUS XhcPeiInitializeDeviceSlot ( IN PEI_XHC_DEV 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 device.
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.
OthersFail to initialize device slot.

Definition at line 1071 of file XhciSched.c.

◆ XhcPeiInitializeDeviceSlot64()

EFI_STATUS XhcPeiInitializeDeviceSlot64 ( IN PEI_XHC_DEV 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 device.
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.
OthersFail to initialize device slot.

Definition at line 1286 of file XhciSched.c.

◆ XhcPeiInitSched()

VOID XhcPeiInitSched ( IN PEI_XHC_DEV Xhc)

Initialize the XHCI host controller for schedule.

Parameters
XhcThe XHCI device to be initialized.

Definition at line 2882 of file XhciSched.c.

◆ XhcPeiPollPortStatusChange()

EFI_STATUS XhcPeiPollPortStatusChange ( IN PEI_XHC_DEV 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 device.
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 863 of file XhciSched.c.

◆ XhcPeiRecoverHaltedEndpoint()

EFI_STATUS XhcPeiRecoverHaltedEndpoint ( IN PEI_XHC_DEV 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 device.
UrbThe urb which makes the endpoint halted.
Return values
EFI_SUCCESSThe recovery is successful.
OthersFailed to recovery halted endpoint.

Definition at line 472 of file XhciSched.c.

◆ XhcPeiResetEndpoint()

EFI_STATUS EFIAPI XhcPeiResetEndpoint ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId,
IN UINT8  Dci 
)

Reset endpoint through XHCI's Reset_Endpoint cmd.

Parameters
XhcThe XHCI device.
SlotIdThe slot id of the target device.
DciThe device context index of the target slot or endpoint.
Return values
EFI_SUCCESSReset endpoint successfully.
OthersFailed to reset endpoint.

Definition at line 2463 of file XhciSched.c.

◆ XhcPeiRingDoorBell()

VOID XhcPeiRingDoorBell ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId,
IN UINT8  Dci 
)

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

Parameters
XhcThe XHCI device.
SlotIdThe slot id of the target device.
DciThe device context index of the target slot or endpoint.

Definition at line 1044 of file XhciSched.c.

◆ XhcPeiRouteStringToSlotId()

UINT8 XhcPeiRouteStringToSlotId ( IN PEI_XHC_DEV Xhc,
IN USB_DEV_ROUTE  RouteString 
)

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

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

Definition at line 1012 of file XhciSched.c.

◆ XhcPeiSetConfigCmd()

EFI_STATUS XhcPeiSetConfigCmd ( IN PEI_XHC_DEV 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 device.
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 1713 of file XhciSched.c.

◆ XhcPeiSetConfigCmd64()

EFI_STATUS XhcPeiSetConfigCmd64 ( IN PEI_XHC_DEV 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 device.
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 1939 of file XhciSched.c.

◆ XhcPeiSetTrDequeuePointer()

EFI_STATUS EFIAPI XhcPeiSetTrDequeuePointer ( IN PEI_XHC_DEV 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 device.
SlotIdThe slot id of the target device.
DciThe device context index of the target slot or 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 2511 of file XhciSched.c.

◆ XhcPeiStopEndpoint()

EFI_STATUS EFIAPI XhcPeiStopEndpoint ( IN PEI_XHC_DEV Xhc,
IN UINT8  SlotId,
IN UINT8  Dci 
)

Stop endpoint through XHCI's Stop_Endpoint cmd.

Parameters
XhcThe XHCI device.
SlotIdThe slot id of the target device.
DciThe device context index of the target slot or endpoint.
Return values
EFI_SUCCESSStop endpoint successfully.
OthersFailed to stop endpoint.

Definition at line 2417 of file XhciSched.c.

◆ XhcPeiSyncEventRing()

EFI_STATUS XhcPeiSyncEventRing ( IN PEI_XHC_DEV Xhc,
IN EVENT_RING EvtRing 
)

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

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

Definition at line 2596 of file XhciSched.c.

◆ XhcPeiSyncTrsRing()

EFI_STATUS XhcPeiSyncTrsRing ( IN PEI_XHC_DEV Xhc,
IN TRANSFER_RING TrsRing 
)

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

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

Definition at line 2772 of file XhciSched.c.