10#ifndef _EFI_PEI_XHCI_SCHED_H_
11#define _EFI_PEI_XHCI_SCHED_H_
16#define XHC_CTRL_TRANSFER 0x01
17#define XHC_BULK_TRANSFER 0x02
22#define TRB_TYPE_NORMAL 1
23#define TRB_TYPE_SETUP_STAGE 2
24#define TRB_TYPE_DATA_STAGE 3
25#define TRB_TYPE_STATUS_STAGE 4
26#define TRB_TYPE_ISOCH 5
27#define TRB_TYPE_LINK 6
28#define TRB_TYPE_EVENT_DATA 7
29#define TRB_TYPE_NO_OP 8
30#define TRB_TYPE_EN_SLOT 9
31#define TRB_TYPE_DIS_SLOT 10
32#define TRB_TYPE_ADDRESS_DEV 11
33#define TRB_TYPE_CON_ENDPOINT 12
34#define TRB_TYPE_EVALU_CONTXT 13
35#define TRB_TYPE_RESET_ENDPOINT 14
36#define TRB_TYPE_STOP_ENDPOINT 15
37#define TRB_TYPE_SET_TR_DEQUE 16
38#define TRB_TYPE_RESET_DEV 17
39#define TRB_TYPE_GET_PORT_BANW 21
40#define TRB_TYPE_FORCE_HEADER 22
41#define TRB_TYPE_NO_OP_COMMAND 23
42#define TRB_TYPE_TRANS_EVENT 32
43#define TRB_TYPE_COMMAND_COMPLT_EVENT 33
44#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34
45#define TRB_TYPE_HOST_CONTROLLER_EVENT 37
46#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38
47#define TRB_TYPE_MFINDEX_WRAP_EVENT 39
55#define ED_INTERRUPT_OUT 3
56#define ED_CONTROL_BIDIR 4
59#define ED_INTERRUPT_IN 7
64#define TRB_COMPLETION_INVALID 0
65#define TRB_COMPLETION_SUCCESS 1
66#define TRB_COMPLETION_DATA_BUFFER_ERROR 2
67#define TRB_COMPLETION_BABBLE_ERROR 3
68#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4
69#define TRB_COMPLETION_TRB_ERROR 5
70#define TRB_COMPLETION_STALL_ERROR 6
71#define TRB_COMPLETION_SHORT_PACKET 13
80 UINT32 RouteString : 20;
84 UINT32 RootPortNum : 8;
150#define XHC_URB_SIG SIGNATURE_32 ('U', 'S', 'B', 'R')
201 UINT32 RingTrbSize : 16;
219 UINT32 IntTarget : 10;
239 UINT32 bmRequestType : 8;
248 UINT32 IntTarget : 10;
271 UINT32 IntTarget : 10;
295 UINT32 IntTarget : 10;
319 UINT32 Completecode : 8;
326 UINT32 EndpointId : 5;
342 UINT32 Completecode : 8;
517 UINT32 StreamID : 16;
537 UINT32 InterTarget : 10;
553 UINT32 RouteString : 20;
558 UINT32 ContextEntries : 5;
560 UINT32 MaxExitLatency : 16;
561 UINT32 RootHubPortNum : 8;
564 UINT32 TTHubSlotId : 8;
565 UINT32 TTPortNum : 8;
568 UINT32 InterTarget : 10;
570 UINT32 DeviceAddress : 8;
572 UINT32 SlotState : 5;
581 UINT32 RouteString : 20;
586 UINT32 ContextEntries : 5;
588 UINT32 MaxExitLatency : 16;
589 UINT32 RootHubPortNum : 8;
592 UINT32 TTHubSlotId : 8;
593 UINT32 TTPortNum : 8;
596 UINT32 InterTarget : 10;
598 UINT32 DeviceAddress : 8;
600 UINT32 SlotState : 5;
625 UINT32 MaxPStreams : 5;
635 UINT32 MaxBurstSize : 8;
636 UINT32 MaxPacketSize : 16;
642 UINT32 AverageTRBLength : 16;
643 UINT32 MaxESITPayload : 16;
654 UINT32 MaxPStreams : 5;
664 UINT32 MaxBurstSize : 8;
665 UINT32 MaxPacketSize : 16;
671 UINT32 AverageTRBLength : 16;
672 UINT32 MaxESITPayload : 16;
766 IN BOOLEAN CmdTransfer,
908 IN UINT8 DeviceSpeed,
927 IN UINT8 DeviceSpeed,
1008 IN UINT16 ParentPort,
1010 IN UINT8 DeviceSpeed
1030 IN UINT16 ParentPort,
1032 IN UINT8 DeviceSpeed
1049 IN UINT32 MaxPacketSize
1066 IN UINT32 MaxPacketSize
EFI_STATUS(EFIAPI * EFI_ASYNC_USB_TRANSFER_CALLBACK)(IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Status)
EFI_STATUS XhcPeiDisableSlotCmd64(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId)
UINT8 XhcPeiRouteStringToSlotId(IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE RouteString)
VOID XhcPeiInitSched(IN PEI_XHC_DEV *Xhc)
EFI_STATUS XhcPeiEvaluateContext(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
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 XhcPeiCheckNewEvent(IN PEI_XHC_DEV *Xhc, IN EVENT_RING *EvtRing, OUT TRB_TEMPLATE **NewEvtTrb)
EFI_STATUS XhcPeiRecoverHaltedEndpoint(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
VOID XhcPeiRingDoorBell(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
VOID XhcPeiFreeSched(IN PEI_XHC_DEV *Xhc)
EFI_STATUS XhcPeiConfigHubContext(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
EFI_STATUS XhcPeiEvaluateContext64(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
EFI_STATUS XhcPeiSyncTrsRing(IN PEI_XHC_DEV *Xhc, IN TRANSFER_RING *TrsRing)
EFI_STATUS XhcPeiDisableSlotCmd(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId)
VOID XhcPeiFreeUrb(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
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 XhcPeiConfigHubContext64(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
EFI_STATUS EFIAPI XhcPeiResetEndpoint(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
URB * XhcPeiCreateUrb(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)
EFI_STATUS EFIAPI XhcPeiStopEndpoint(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
UINT8 XhcPeiBusDevAddrToSlotId(IN PEI_XHC_DEV *Xhc, IN UINT8 BusDevAddr)
EFI_STATUS XhcPeiCreateTransferTrb(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
EFI_STATUS XhcPeiSyncEventRing(IN PEI_XHC_DEV *Xhc, IN EVENT_RING *EvtRing)
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 XhcPeiExecTransfer(IN PEI_XHC_DEV *Xhc, IN BOOLEAN CmdTransfer, IN URB *Urb, IN UINTN Timeout)
VOID XhcPeiCreateTransferRing(IN PEI_XHC_DEV *Xhc, IN UINTN TrbNum, OUT TRANSFER_RING *TransferRing)
EFI_STATUS XhcPeiDequeueTrbFromEndpoint(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
VOID XhcPeiCreateEventRing(IN PEI_XHC_DEV *Xhc, OUT EVENT_RING *EventRing)
UINT8 XhcPeiEndpointToDci(IN UINT8 EpAddr, IN EFI_USB_DATA_DIRECTION Direction)
EFI_STATUS XhcPeiPollPortStatusChange(IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT8 Port, IN EFI_USB_PORT_STATUS *PortState)
EFI_STATUS EFIAPI XhcPeiSetTrDequeuePointer(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *Urb)