10#ifndef _EFI_XHCI_SCHED_H_
11#define _EFI_XHCI_SCHED_H_
13#define XHC_URB_SIG SIGNATURE_32 ('U', 'S', 'B', 'R')
14#define XHC_INIT_DEVICE_SLOT_RETRIES 1
19#define XHC_CTRL_TRANSFER 0x01
20#define XHC_BULK_TRANSFER 0x02
21#define XHC_INT_TRANSFER_SYNC 0x04
22#define XHC_INT_TRANSFER_ASYNC 0x08
23#define XHC_INT_ONLY_TRANSFER_ASYNC 0x10
28#define TRB_TYPE_NORMAL 1
29#define TRB_TYPE_SETUP_STAGE 2
30#define TRB_TYPE_DATA_STAGE 3
31#define TRB_TYPE_STATUS_STAGE 4
32#define TRB_TYPE_ISOCH 5
33#define TRB_TYPE_LINK 6
34#define TRB_TYPE_EVENT_DATA 7
35#define TRB_TYPE_NO_OP 8
36#define TRB_TYPE_EN_SLOT 9
37#define TRB_TYPE_DIS_SLOT 10
38#define TRB_TYPE_ADDRESS_DEV 11
39#define TRB_TYPE_CON_ENDPOINT 12
40#define TRB_TYPE_EVALU_CONTXT 13
41#define TRB_TYPE_RESET_ENDPOINT 14
42#define TRB_TYPE_STOP_ENDPOINT 15
43#define TRB_TYPE_SET_TR_DEQUE 16
44#define TRB_TYPE_RESET_DEV 17
45#define TRB_TYPE_GET_PORT_BANW 21
46#define TRB_TYPE_FORCE_HEADER 22
47#define TRB_TYPE_NO_OP_COMMAND 23
48#define TRB_TYPE_TRANS_EVENT 32
49#define TRB_TYPE_COMMAND_COMPLT_EVENT 33
50#define TRB_TYPE_PORT_STATUS_CHANGE_EVENT 34
51#define TRB_TYPE_HOST_CONTROLLER_EVENT 37
52#define TRB_TYPE_DEVICE_NOTIFI_EVENT 38
53#define TRB_TYPE_MFINDEX_WRAP_EVENT 39
61#define ED_INTERRUPT_OUT 3
62#define ED_CONTROL_BIDIR 4
65#define ED_INTERRUPT_IN 7
70#define TRB_COMPLETION_INVALID 0
71#define TRB_COMPLETION_SUCCESS 1
72#define TRB_COMPLETION_DATA_BUFFER_ERROR 2
73#define TRB_COMPLETION_BABBLE_ERROR 3
74#define TRB_COMPLETION_USB_TRANSACTION_ERROR 4
75#define TRB_COMPLETION_TRB_ERROR 5
76#define TRB_COMPLETION_STALL_ERROR 6
77#define TRB_COMPLETION_SHORT_PACKET 13
78#define TRB_COMPLETION_STOPPED 26
79#define TRB_COMPLETION_STOPPED_LENGTH_INVALID 27
86#define EDKII_USB_ERR_TRANSACTION 0x200
95 UINT32 RouteString : 20;
99 UINT32 RootPortNum : 8;
215 UINT32 RingTrbSize : 16;
233 UINT32 IntTarget : 10;
253 UINT32 bmRequestType : 8;
262 UINT32 IntTarget : 10;
285 UINT32 IntTarget : 10;
309 UINT32 IntTarget : 10;
333 UINT32 Completecode : 8;
340 UINT32 EndpointId : 5;
356 UINT32 Completecode : 8;
531 UINT32 StreamID : 16;
551 UINT32 InterTarget : 10;
567 UINT32 RouteString : 20;
572 UINT32 ContextEntries : 5;
574 UINT32 MaxExitLatency : 16;
575 UINT32 RootHubPortNum : 8;
578 UINT32 TTHubSlotId : 8;
579 UINT32 TTPortNum : 8;
582 UINT32 InterTarget : 10;
584 UINT32 DeviceAddress : 8;
586 UINT32 SlotState : 5;
595 UINT32 RouteString : 20;
600 UINT32 ContextEntries : 5;
602 UINT32 MaxExitLatency : 16;
603 UINT32 RootHubPortNum : 8;
606 UINT32 TTHubSlotId : 8;
607 UINT32 TTPortNum : 8;
610 UINT32 InterTarget : 10;
612 UINT32 DeviceAddress : 8;
614 UINT32 SlotState : 5;
639 UINT32 MaxPStreams : 5;
649 UINT32 MaxBurstSize : 8;
650 UINT32 MaxPacketSize : 16;
656 UINT32 AverageTRBLength : 16;
657 UINT32 MaxESITPayload : 16;
668 UINT32 MaxPStreams : 5;
678 UINT32 MaxBurstSize : 8;
679 UINT32 MaxPacketSize : 16;
685 UINT32 AverageTRBLength : 16;
686 UINT32 MaxESITPayload : 16;
817 IN BOOLEAN CmdTransfer,
1044 IN UINT8 DeviceSpeed,
1064 IN UINT8 DeviceSpeed,
1085 IN UINT8 DeviceSpeed,
1107 IN UINT8 DeviceSpeed,
1145 IN UINT16 ParentPort,
1147 IN UINT8 DeviceSpeed
1167 IN UINT16 ParentPort,
1169 IN UINT8 DeviceSpeed
1187 IN UINT32 MaxPacketSize
1205 IN UINT32 MaxPacketSize
1378 IN URB *PendingUrb OPTIONAL
EFI_STATUS(EFIAPI * EFI_ASYNC_USB_TRANSFER_CALLBACK)(IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Status)
EFI_STATUS EFIAPI XhcSetConfigCmd64(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
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)
EFI_STATUS EFIAPI XhcDisableSlotCmd(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId)
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)
VOID XhciDelAllAsyncIntTransfers(IN USB_XHCI_INSTANCE *Xhc)
VOID XhcClearBiosOwnership(IN USB_XHCI_INSTANCE *Xhc)
VOID CreateEventRing(IN USB_XHCI_INSTANCE *Xhc, OUT EVENT_RING *EventRing)
VOID XhcFreeUrb(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
EFI_STATUS EFIAPI XhcSetTrDequeuePointer(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *Urb)
EFI_STATUS EFIAPI XhcResetEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
EFI_STATUS XhciDelAsyncIntTransfer(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusAddr, IN UINT8 EpNum)
EFI_STATUS XhcConfigHubContext64(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
EFI_STATUS EFIAPI XhcSyncEventRing(IN USB_XHCI_INSTANCE *Xhc, EVENT_RING *EvtRing)
VOID XhcFreeSched(IN USB_XHCI_INSTANCE *Xhc)
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 XhcCheckNewEvent(IN USB_XHCI_INSTANCE *Xhc, IN EVENT_RING *EvtRing, OUT TRB_TEMPLATE **NewEvtTrb)
EFI_STATUS EFIAPI XhcRecoverHaltedEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
EFI_STATUS EFIAPI XhcSyncTrsRing(IN USB_XHCI_INSTANCE *Xhc, TRANSFER_RING *TrsRing)
VOID EFIAPI XhcMonitorAsyncRequests(IN EFI_EVENT Event, IN VOID *Context)
VOID CreateTransferRing(IN USB_XHCI_INSTANCE *Xhc, IN UINTN TrbNum, OUT TRANSFER_RING *TransferRing)
VOID XhcSetBiosOwnership(IN USB_XHCI_INSTANCE *Xhc)
EFI_STATUS XhcCreateTransferTrb(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
EFI_STATUS EFIAPI XhcDequeueTrbFromEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
UINT8 XhcEndpointToDci(IN UINT8 EpAddr, IN UINT8 Direction)
EFI_STATUS EFIAPI XhcEvaluateContext64(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
VOID XhcInitSched(IN USB_XHCI_INSTANCE *Xhc)
EFI_STATUS RingIntTransferDoorBell(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
EFI_STATUS EFIAPI XhcRingDoorBell(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
EFI_STATUS XhcConfigHubContext(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
EFI_STATUS EFIAPI XhcEvaluateContext(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
EFI_STATUS EFIAPI XhcStopEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci, IN URB *PendingUrb OPTIONAL)
EFI_STATUS XhcExecTransfer(IN USB_XHCI_INSTANCE *Xhc, IN BOOLEAN CmdTransfer, IN URB *Urb, IN UINTN Timeout)
EFI_STATUS EFIAPI XhcSetConfigCmd(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 DeviceSpeed, IN USB_CONFIG_DESCRIPTOR *ConfigDesc)
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)
URB * XhcCreateUrb(IN USB_XHCI_INSTANCE *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)
UINT8 EFIAPI XhcRouteStringToSlotId(IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE RouteString)
EFI_STATUS EFIAPI XhcDisableSlotCmd64(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId)
UINT8 EFIAPI XhcBusDevAddrToSlotId(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusDevAddr)
EFI_STATUS EFIAPI XhcPollPortStatusChange(IN USB_XHCI_INSTANCE *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT8 Port, IN EFI_USB_PORT_STATUS *PortState)
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)