18 { XHC_PORTSC_PED, USB_PORT_STAT_ENABLE },
19 { XHC_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
20 { XHC_PORTSC_RESET, USB_PORT_STAT_RESET }
25 { XHC_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
26 { XHC_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
27 { XHC_PORTSC_PRC, USB_PORT_STAT_C_RESET }
31 { XHC_PORTSC_CSC, EfiUsbPortConnectChange },
32 { XHC_PORTSC_PEC, EfiUsbPortEnableChange },
33 { XHC_PORTSC_OCC, EfiUsbPortOverCurrentChange },
34 { XHC_PORTSC_PRC, EfiUsbPortResetChange }
39 { XHC_HUB_PORTSC_PED, USB_PORT_STAT_ENABLE },
40 { XHC_HUB_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
41 { XHC_HUB_PORTSC_RESET, USB_PORT_STAT_RESET }
46 { XHC_HUB_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
47 { XHC_HUB_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
48 { XHC_HUB_PORTSC_PRC, USB_PORT_STAT_C_RESET }
52 { XHC_HUB_PORTSC_CSC, EfiUsbPortConnectChange },
53 { XHC_HUB_PORTSC_PEC, EfiUsbPortEnableChange },
54 { XHC_HUB_PORTSC_OCC, EfiUsbPortOverCurrentChange },
55 { XHC_HUB_PORTSC_PRC, EfiUsbPortResetChange },
56 { XHC_HUB_PORTSC_BHRC, Usb3PortBHPortResetChange }
89static UINT64 mXhciPerformanceCounterStartValue;
90static UINT64 mXhciPerformanceCounterEndValue;
91static UINT64 mXhciPerformanceCounterFrequency;
92static BOOLEAN mXhciPerformanceCounterValuesCached =
FALSE;
112 OUT UINT8 *PortNumber,
113 OUT UINT8 *Is64BitCapable
119 if ((MaxSpeed ==
NULL) || (PortNumber ==
NULL) || (Is64BitCapable ==
NULL)) {
120 return EFI_INVALID_PARAMETER;
123 OldTpl =
gBS->RaiseTPL (XHC_TPL);
125 Xhc = XHC_FROM_THIS (This);
127 *PortNumber = (UINT8)(Xhc->
HcSParams1.Data.MaxPorts);
128 *Is64BitCapable = (UINT8)Xhc->Support64BitDma;
129 DEBUG ((DEBUG_INFO,
"XhcGetCapability: %d ports, 64 bit %d\n", *PortNumber, *Is64BitCapable));
131 gBS->RestoreTPL (OldTpl);
160 Xhc = XHC_FROM_THIS (This);
162 if (Xhc->DevicePath !=
NULL) {
168 (EFI_IO_BUS_USB | EFI_IOB_PC_RESET),
173 OldTpl =
gBS->RaiseTPL (XHC_TPL);
175 switch (Attributes) {
176 case EFI_USB_HC_RESET_GLOBAL:
180 case EFI_USB_HC_RESET_HOST_CONTROLLER:
181 if ((Xhc->DebugCapSupOffset != 0xFFFFFFFF) && ((
XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) == XHC_CAP_USB_DEBUG) &&
182 ((
XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) != 0))
192 Status =
XhcHaltHC (Xhc, XHC_GENERIC_TIMEOUT);
194 if (EFI_ERROR (Status)) {
195 Status = EFI_DEVICE_ERROR;
201 ASSERT (!(XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_CNR)));
203 if (EFI_ERROR (Status)) {
217 case EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG:
218 case EFI_USB_HC_RESET_HOST_WITH_DEBUG:
219 Status = EFI_UNSUPPORTED;
223 Status = EFI_INVALID_PARAMETER;
227 DEBUG ((DEBUG_INFO,
"XhcReset: status %r\n", Status));
228 gBS->RestoreTPL (OldTpl);
257 return EFI_INVALID_PARAMETER;
260 OldTpl =
gBS->RaiseTPL (XHC_TPL);
262 Xhc = XHC_FROM_THIS (This);
264 if (XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT)) {
270 DEBUG ((DEBUG_INFO,
"XhcGetState: current state %d\n", *State));
271 gBS->RestoreTPL (OldTpl);
302 if (EFI_ERROR (Status)) {
303 return EFI_DEVICE_ERROR;
306 if (CurState == State) {
310 OldTpl =
gBS->RaiseTPL (XHC_TPL);
312 Xhc = XHC_FROM_THIS (This);
316 Status =
XhcHaltHC (Xhc, XHC_GENERIC_TIMEOUT);
320 if (XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HSE)) {
321 Status = EFI_DEVICE_ERROR;
330 if (!XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT)) {
331 Status = EFI_DEVICE_ERROR;
335 Status =
XhcRunHC (Xhc, XHC_GENERIC_TIMEOUT);
339 Status = EFI_UNSUPPORTED;
343 Status = EFI_INVALID_PARAMETER;
346 DEBUG ((DEBUG_INFO,
"XhcSetState: status %r\n", Status));
347 gBS->RestoreTPL (OldTpl);
385 if (PortStatus ==
NULL) {
386 return EFI_INVALID_PARAMETER;
389 OldTpl =
gBS->RaiseTPL (XHC_TPL);
391 Xhc = XHC_FROM_THIS (This);
396 if (PortNumber >= TotalPort) {
397 Status = EFI_INVALID_PARAMETER;
401 Offset = (UINT32)(XHC_PORTSC_OFFSET + (0x10 * PortNumber));
402 PortStatus->PortStatus = 0;
403 PortStatus->PortChangeStatus = 0;
407 PortSpeed = (State & XHC_PORTSC_PS) >> 10;
416 if (PortStatus->PortStatus == 0) {
423 PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
427 PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
432 PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
446 for (Index = 0; Index < MapSize; Index++) {
447 if (XHC_BIT_IS_SET (State, mUsbPortStateMap[Index].HwState)) {
448 PortStatus->PortStatus = (UINT16)(PortStatus->PortStatus | mUsbPortStateMap[Index].UefiState);
455 if ((State & XHC_PORTSC_PLS) >> 5 == 3) {
456 PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
461 for (Index = 0; Index < MapSize; Index++) {
462 if (XHC_BIT_IS_SET (State, mUsbPortChangeMap[Index].HwState)) {
463 PortStatus->PortChangeStatus = (UINT16)(PortStatus->PortChangeStatus | mUsbPortChangeMap[Index].UefiState);
469 for (Index = 0; Index < MapSize; Index++) {
470 if (XHC_BIT_IS_SET (State, mUsbClearPortChangeMap[Index].HwState)) {
479 ParentRouteChart.Dword = 0;
486 if (EFI_ERROR (Status)) {
487 PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
492 gBS->RestoreTPL (OldTpl);
523 OldTpl =
gBS->RaiseTPL (XHC_TPL);
525 Xhc = XHC_FROM_THIS (This);
530 if (PortNumber >= TotalPort) {
531 Status = EFI_INVALID_PARAMETER;
535 Offset = (UINT32)(XHC_PORTSC_OFFSET + (0x10 * PortNumber));
542 State &= ~(BIT1 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | BIT23);
544 switch (PortFeature) {
545 case EfiUsbPortEnable:
553 case EfiUsbPortSuspend:
554 State |= XHC_PORTSC_LWS;
556 State &= ~XHC_PORTSC_PLS;
561 case EfiUsbPortReset:
562 DEBUG ((DEBUG_INFO,
"XhcUsbPortReset!\n"));
567 Status =
XhcRunHC (Xhc, XHC_GENERIC_TIMEOUT);
569 if (EFI_ERROR (Status)) {
570 DEBUG ((DEBUG_INFO,
"XhcSetRootHubPortFeature :failed to start HC - %r\n", Status));
579 State |= XHC_PORTSC_RESET;
584 case EfiUsbPortPower:
591 case EfiUsbPortOwner:
599 Status = EFI_INVALID_PARAMETER;
603 DEBUG ((DEBUG_INFO,
"XhcSetRootHubPortFeature: status %r\n", Status));
604 gBS->RestoreTPL (OldTpl);
639 OldTpl =
gBS->RaiseTPL (XHC_TPL);
641 Xhc = XHC_FROM_THIS (This);
646 if (PortNumber >= TotalPort) {
647 Status = EFI_INVALID_PARAMETER;
651 Offset = XHC_PORTSC_OFFSET + (0x10 * PortNumber);
658 State &= ~(BIT1 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | BIT23);
660 switch (PortFeature) {
661 case EfiUsbPortEnable:
666 State |= XHC_PORTSC_PED;
667 State &= ~XHC_PORTSC_RESET;
671 case EfiUsbPortSuspend:
672 State |= XHC_PORTSC_LWS;
674 State &= ~XHC_PORTSC_PLS;
678 case EfiUsbPortReset:
686 case EfiUsbPortOwner:
692 case EfiUsbPortConnectChange:
696 State |= XHC_PORTSC_CSC;
700 case EfiUsbPortEnableChange:
704 State |= XHC_PORTSC_PEC;
708 case EfiUsbPortOverCurrentChange:
712 State |= XHC_PORTSC_OCC;
716 case EfiUsbPortResetChange:
720 State |= XHC_PORTSC_PRC;
724 case EfiUsbPortPower:
725 case EfiUsbPortSuspendChange:
732 Status = EFI_INVALID_PARAMETER;
737 DEBUG ((DEBUG_INFO,
"XhcClearRootHubPortFeature: status %r\n", Status));
738 gBS->RestoreTPL (OldTpl);
769 IN UINT8 DeviceAddress,
770 IN UINT8 EndPointAddress,
771 IN UINT8 DeviceSpeed,
778 OUT UINT32 *TransferResult
785 ASSERT ((Type == XHC_CTRL_TRANSFER) || (Type == XHC_BULK_TRANSFER) || (Type == XHC_INT_TRANSFER_SYNC));
801 DEBUG ((DEBUG_ERROR,
"XhcTransfer[Type=%d]: failed to create URB!\n", Type));
802 return EFI_OUT_OF_RESOURCES;
807 if (Status == EFI_TIMEOUT) {
812 if (RecoveryStatus == EFI_ALREADY_STARTED) {
817 ASSERT (Urb->Result == EFI_USB_NOERROR);
819 DEBUG ((DEBUG_ERROR,
"XhcTransfer[Type=%d]: pending URB is finished, Length = %d.\n", Type, Urb->Completed));
820 }
else if (EFI_ERROR (RecoveryStatus)) {
821 DEBUG ((DEBUG_ERROR,
"XhcTransfer[Type=%d]: XhcDequeueTrbFromEndpoint failed!\n", Type));
825 *TransferResult = Urb->Result;
826 *DataLength = Urb->Completed;
831 if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EDKII_USB_ERR_TRANSACTION)) {
832 ASSERT (Status == EFI_DEVICE_ERROR);
834 if (EFI_ERROR (RecoveryStatus)) {
835 DEBUG ((DEBUG_ERROR,
"XhcTransfer[Type=%d]: XhcRecoverHaltedEndpoint failed!\n", Type));
839 Xhc->PciIo->Flush (Xhc->PciIo);
872 IN UINT8 DeviceAddress,
873 IN UINT8 DeviceSpeed,
881 OUT UINT32 *TransferResult
887 UINT8 DescriptorType;
904 if ((Request ==
NULL) || (TransferResult ==
NULL)) {
905 return EFI_INVALID_PARAMETER;
908 if ((TransferDirection != EfiUsbDataIn) &&
909 (TransferDirection != EfiUsbDataOut) &&
910 (TransferDirection != EfiUsbNoData))
912 return EFI_INVALID_PARAMETER;
915 if ((TransferDirection == EfiUsbNoData) &&
916 ((Data !=
NULL) || (*DataLength != 0)))
918 return EFI_INVALID_PARAMETER;
921 if ((TransferDirection != EfiUsbNoData) &&
922 ((Data ==
NULL) || (*DataLength == 0)))
924 return EFI_INVALID_PARAMETER;
927 if ((MaximumPacketLength != 8) && (MaximumPacketLength != 16) &&
928 (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&
929 (MaximumPacketLength != 512)
932 return EFI_INVALID_PARAMETER;
935 if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) {
936 return EFI_INVALID_PARAMETER;
940 return EFI_INVALID_PARAMETER;
943 OldTpl =
gBS->RaiseTPL (XHC_TPL);
945 Xhc = XHC_FROM_THIS (This);
947 Status = EFI_DEVICE_ERROR;
948 *TransferResult = EFI_USB_ERR_SYSTEM;
952 DEBUG ((DEBUG_ERROR,
"XhcControlTransfer: HC halted at entrance\n"));
968 if ((Request->Request == USB_REQ_SET_ADDRESS) &&
969 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)))
975 for (Index = 0; Index < 255; Index++) {
976 if (!Xhc->UsbDevContext[Index + 1].Enabled &&
977 (Xhc->UsbDevContext[Index + 1].SlotId == 0) &&
978 (Xhc->UsbDevContext[Index + 1].BusDevAddr == (UINT8)Request->Value))
980 Xhc->UsbDevContext[Index + 1].BusDevAddr = 0;
984 if (Xhc->UsbDevContext[SlotId].XhciDevAddr == 0) {
985 Status = EFI_DEVICE_ERROR;
995 Xhc->UsbDevContext[SlotId].BusDevAddr = (UINT8)Request->Value;
1007 Endpoint = (UINT8)(0 | ((TransferDirection == EfiUsbDataIn) ? 0x80 : 0));
1013 MaximumPacketLength,
1022 if (EFI_ERROR (Status)) {
1031 if ((Request->Request == USB_REQ_GET_DESCRIPTOR) &&
1032 ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)) ||
1033 ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_DEVICE)))))
1035 DescriptorType = (UINT8)(Request->Value >> 8);
1036 if ((DescriptorType == USB_DESC_TYPE_DEVICE) && ((*DataLength ==
sizeof (
EFI_USB_DEVICE_DESCRIPTOR)) || ((DeviceSpeed == EFI_USB_SPEED_FULL) && (*DataLength == 8)))) {
1037 ASSERT (Data !=
NULL);
1041 CopyMem (&Xhc->UsbDevContext[SlotId].DevDesc, Data, *DataLength);
1042 if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB >= 0x0300) {
1046 MaxPacket0 = 1 << Xhc->UsbDevContext[SlotId].DevDesc.MaxPacketSize0;
1048 MaxPacket0 = Xhc->UsbDevContext[SlotId].DevDesc.MaxPacketSize0;
1057 }
else if (DescriptorType == USB_DESC_TYPE_CONFIG) {
1058 ASSERT (Data !=
NULL);
1059 if (*DataLength == ((UINT16 *)Data)[1]) {
1063 Index = (UINT8)Request->Value;
1064 ASSERT (Index < Xhc->UsbDevContext[SlotId].DevDesc.NumConfigurations);
1065 Xhc->UsbDevContext[SlotId].ConfDesc[Index] =
AllocateZeroPool (*DataLength);
1066 CopyMem (Xhc->UsbDevContext[SlotId].ConfDesc[Index], Data, *DataLength);
1070 Xhc->UsbDevContext[SlotId].ActiveAlternateSetting =
AllocateZeroPool (Xhc->UsbDevContext[SlotId].ConfDesc[Index]->NumInterfaces * sizeof (UINT8));
1072 }
else if (((DescriptorType == USB_DESC_TYPE_HUB) ||
1073 (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) && (*DataLength > 2))
1075 ASSERT (Data !=
NULL);
1077 ASSERT (HubDesc->NumPorts <= 15);
1081 TTT = (UINT8)((HubDesc->HubCharacter & (BIT5 | BIT6)) >> 5);
1082 if (Xhc->UsbDevContext[SlotId].DevDesc.DeviceProtocol == 2) {
1087 DEBUG ((DEBUG_ERROR,
"XHCI: Don't support multi-TT feature for Hub now. (force to disable MTT)\n"));
1098 }
else if ((Request->Request == USB_REQ_SET_CONFIG) &&
1099 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)))
1104 for (Index = 0; Index < Xhc->UsbDevContext[SlotId].DevDesc.NumConfigurations; Index++) {
1105 if (Xhc->UsbDevContext[SlotId].ConfDesc[Index]->ConfigurationValue == (UINT8)Request->Value) {
1107 Status =
XhcSetConfigCmd (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
1109 Status =
XhcSetConfigCmd64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
1115 }
else if ((Request->Request == USB_REQ_SET_INTERFACE) &&
1116 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_INTERFACE)))
1123 if (Xhc->UsbDevContext[SlotId].ActiveAlternateSetting[(UINT8)Request->Index] != (UINT8)Request->Value) {
1125 Status =
XhcSetInterface (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Xhc->UsbDevContext[SlotId].ActiveConfiguration - 1], Request);
1127 Status =
XhcSetInterface64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Xhc->UsbDevContext[SlotId].ActiveConfiguration - 1], Request);
1130 }
else if ((Request->Request == USB_REQ_GET_STATUS) &&
1131 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_OTHER)))
1133 ASSERT (Data !=
NULL);
1137 State = *(UINT32 *)Data;
1145 if ((State & XHC_PORTSC_PS) >> 10 == 0) {
1146 PortStatus.
PortStatus |= USB_PORT_STAT_SUPER_SPEED;
1152 if (XHC_BIT_IS_SET (State, BIT9)) {
1153 PortStatus.
PortStatus |= USB_PORT_STAT_LOW_SPEED;
1154 }
else if (XHC_BIT_IS_SET (State, BIT10)) {
1155 PortStatus.
PortStatus |= USB_PORT_STAT_HIGH_SPEED;
1163 for (Index = 0; Index < MapSize; Index++) {
1164 if (XHC_BIT_IS_SET (State, mUsbHubPortStateMap[Index].HwState)) {
1165 PortStatus.
PortStatus = (UINT16)(PortStatus.
PortStatus | mUsbHubPortStateMap[Index].UefiState);
1170 for (Index = 0; Index < MapSize; Index++) {
1171 if (XHC_BIT_IS_SET (State, mUsbHubPortChangeMap[Index].HwState)) {
1178 for (Index = 0; Index < MapSize; Index++) {
1179 if (XHC_BIT_IS_SET (State, mUsbHubClearPortChangeMap[Index].HwState)) {
1181 ClearPortRequest.RequestType = USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_CLASS, USB_TARGET_OTHER);
1182 ClearPortRequest.Request = (UINT8)USB_REQ_CLEAR_FEATURE;
1183 ClearPortRequest.Value = mUsbHubClearPortChangeMap[Index].Selector;
1184 ClearPortRequest.Index = Request->Index;
1185 ClearPortRequest.Length = 0;
1191 MaximumPacketLength,
1205 *(UINT32 *)Data = *(UINT32 *)&PortStatus;
1209 if (EFI_ERROR (Status)) {
1210 DEBUG ((DEBUG_ERROR,
"XhcControlTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
1213 gBS->RestoreTPL (OldTpl);
1252 IN UINT8 DeviceAddress,
1253 IN UINT8 EndPointAddress,
1254 IN UINT8 DeviceSpeed,
1256 IN UINT8 DataBuffersNumber,
1257 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
1259 IN OUT UINT8 *DataToggle,
1262 OUT UINT32 *TransferResult
1269 UINTN DebugErrorLevel;
1274 if ((DataLength ==
NULL) || (*DataLength == 0) ||
1275 (Data ==
NULL) || (Data[0] ==
NULL) || (TransferResult ==
NULL))
1277 return EFI_INVALID_PARAMETER;
1280 if ((*DataToggle != 0) && (*DataToggle != 1)) {
1281 return EFI_INVALID_PARAMETER;
1284 if ((DeviceSpeed == EFI_USB_SPEED_LOW) ||
1285 ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) ||
1286 ((EFI_USB_SPEED_HIGH == DeviceSpeed) && (MaximumPacketLength > 512)) ||
1289 return EFI_INVALID_PARAMETER;
1292 OldTpl =
gBS->RaiseTPL (XHC_TPL);
1294 Xhc = XHC_FROM_THIS (This);
1296 *TransferResult = EFI_USB_ERR_SYSTEM;
1297 Status = EFI_DEVICE_ERROR;
1300 DEBUG ((DEBUG_ERROR,
"XhcBulkTransfer: HC is halted\n"));
1321 MaximumPacketLength,
1331 if (EFI_ERROR (Status)) {
1332 if (Status == EFI_TIMEOUT) {
1333 DebugErrorLevel = DEBUG_VERBOSE;
1335 DebugErrorLevel = DEBUG_ERROR;
1338 DEBUG ((DebugErrorLevel,
"XhcBulkTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
1341 gBS->RestoreTPL (OldTpl);
1379 IN UINT8 DeviceAddress,
1380 IN UINT8 EndPointAddress,
1381 IN UINT8 DeviceSpeed,
1383 IN BOOLEAN IsNewTransfer,
1384 IN OUT UINT8 *DataToggle,
1389 IN VOID *Context OPTIONAL
1402 if (!XHCI_IS_DATAIN (EndPointAddress)) {
1403 return EFI_INVALID_PARAMETER;
1406 if (IsNewTransfer) {
1407 if (DataLength == 0) {
1408 return EFI_INVALID_PARAMETER;
1411 if ((*DataToggle != 1) && (*DataToggle != 0)) {
1412 return EFI_INVALID_PARAMETER;
1415 if ((PollingInterval > 255) || (PollingInterval < 1)) {
1416 return EFI_INVALID_PARAMETER;
1420 OldTpl =
gBS->RaiseTPL (XHC_TPL);
1422 Xhc = XHC_FROM_THIS (This);
1427 if (!IsNewTransfer) {
1431 for (Index = 0; Index < 255; Index++) {
1432 if (Xhc->UsbDevContext[Index + 1].BusDevAddr == DeviceAddress) {
1438 Status = EFI_INVALID_PARAMETER;
1443 DEBUG ((DEBUG_INFO,
"XhcAsyncInterruptTransfer: remove old transfer for addr %d, Status = %r\n", DeviceAddress, Status));
1450 DEBUG ((DEBUG_ERROR,
"XhcAsyncInterruptTransfer: HC is halt\n"));
1451 Status = EFI_DEVICE_ERROR;
1468 MaximumPacketLength,
1474 Status = EFI_OUT_OF_RESOURCES;
1484 Xhc->PciIo->Flush (Xhc->PciIo);
1485 gBS->RestoreTPL (OldTpl);
1521 IN UINT8 DeviceAddress,
1522 IN UINT8 EndPointAddress,
1523 IN UINT8 DeviceSpeed,
1527 IN OUT UINT8 *DataToggle,
1530 OUT UINT32 *TransferResult
1541 if ((DataLength ==
NULL) || (*DataLength == 0) ||
1542 (Data ==
NULL) || (TransferResult ==
NULL))
1544 return EFI_INVALID_PARAMETER;
1547 if ((*DataToggle != 1) && (*DataToggle != 0)) {
1548 return EFI_INVALID_PARAMETER;
1551 if (((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) ||
1552 ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) ||
1553 ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength > 3072)))
1555 return EFI_INVALID_PARAMETER;
1558 OldTpl =
gBS->RaiseTPL (XHC_TPL);
1560 Xhc = XHC_FROM_THIS (This);
1562 *TransferResult = EFI_USB_ERR_SYSTEM;
1563 Status = EFI_DEVICE_ERROR;
1566 DEBUG ((DEBUG_ERROR,
"EhcSyncInterruptTransfer: HC is halt\n"));
1583 MaximumPacketLength,
1584 XHC_INT_TRANSFER_SYNC,
1593 if (EFI_ERROR (Status)) {
1594 DEBUG ((DEBUG_ERROR,
"XhcSyncInterruptTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
1597 gBS->RestoreTPL (OldTpl);
1627 IN UINT8 DeviceAddress,
1628 IN UINT8 EndPointAddress,
1629 IN UINT8 DeviceSpeed,
1631 IN UINT8 DataBuffersNumber,
1632 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
1635 OUT UINT32 *TransferResult
1638 return EFI_UNSUPPORTED;
1668 IN UINT8 DeviceAddress,
1669 IN UINT8 EndPointAddress,
1670 IN UINT8 DeviceSpeed,
1672 IN UINT8 DataBuffersNumber,
1673 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
1680 return EFI_UNSUPPORTED;
1703 &gXhciDriverBinding,
1705 &gXhciComponentName,
1706 &gXhciComponentName2
1738 Status =
gBS->OpenProtocol (
1740 &gEfiPciIoProtocolGuid,
1742 This->DriverBindingHandle,
1744 EFI_OPEN_PROTOCOL_BY_DRIVER
1747 if (EFI_ERROR (Status)) {
1748 return EFI_UNSUPPORTED;
1751 Status = PciIo->Pci.
Read (
1754 PCI_CLASSCODE_OFFSET,
1759 if (EFI_ERROR (Status)) {
1760 Status = EFI_UNSUPPORTED;
1767 if ((UsbClassCReg.BaseCode != PCI_CLASS_SERIAL) ||
1768 (UsbClassCReg.SubClassCode != PCI_CLASS_SERIAL_USB) ||
1769 (UsbClassCReg.ProgInterface != PCI_IF_XHCI))
1771 Status = EFI_UNSUPPORTED;
1775 gBS->CloseProtocol (
1777 &gEfiPciIoProtocolGuid,
1778 This->DriverBindingHandle,
1800 IN UINT64 OriginalPciAttributes
1807 UINT8 ReleaseNumber;
1818 Xhc->Signature = XHCI_INSTANCE_SIG;
1820 Xhc->DevicePath = DevicePath;
1821 Xhc->OriginalPciAttributes = OriginalPciAttributes;
1824 Status = PciIo->Pci.Read (
1827 XHC_PCI_SBRN_OFFSET,
1832 if (!EFI_ERROR (Status)) {
1855 if ((PageSize & (~XHC_PAGESIZE_MASK)) != 0) {
1856 DEBUG ((DEBUG_ERROR,
"XhcCreateUsb3Hc: Reserved bits are not 0 for PageSize\n"));
1860 PageSize &= XHC_PAGESIZE_MASK;
1863 ExtCapReg = (UINT16)(Xhc->
HcCParams.Data.ExtCapReg);
1864 Xhc->ExtCapRegBase = ExtCapReg << 2;
1870 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: Capability length 0x%x\n", Xhc->
CapLength));
1871 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: HcSParams1 0x%x\n", Xhc->
HcSParams1));
1872 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: HcSParams2 0x%x\n", Xhc->
HcSParams2));
1873 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: HcCParams 0x%x\n", Xhc->
HcCParams));
1874 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: DBOff 0x%x\n", Xhc->
DBOff));
1875 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: RTSOff 0x%x\n", Xhc->
RTSOff));
1876 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: UsbLegSupOffset 0x%x\n", Xhc->UsbLegSupOffset));
1877 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: DebugCapSupOffset 0x%x\n", Xhc->DebugCapSupOffset));
1878 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: Usb2SupOffset 0x%x\n", Xhc->Usb2SupOffset));
1879 DEBUG ((DEBUG_INFO,
"XhcCreateUsb3Hc: Usb3SupOffset 0x%x\n", Xhc->Usb3SupOffset));
1884 Status =
gBS->CreateEvent (
1885 EVT_TIMER | EVT_NOTIFY_SIGNAL,
1892 if (EFI_ERROR (Status)) {
1931 if (Xhc->PollTimer !=
NULL) {
1932 gBS->CloseEvent (Xhc->PollTimer);
1943 Xhc->OriginalPciAttributes,
1972 UINT64 OriginalPciAttributes;
1973 BOOLEAN PciAttributesSaved;
1980 Status =
gBS->OpenProtocol (
1982 &gEfiPciIoProtocolGuid,
1984 This->DriverBindingHandle,
1986 EFI_OPEN_PROTOCOL_BY_DRIVER
1989 if (EFI_ERROR (Status)) {
1996 HcDevicePath =
NULL;
1997 Status =
gBS->OpenProtocol (
1999 &gEfiDevicePathProtocolGuid,
2000 (VOID **)&HcDevicePath,
2001 This->DriverBindingHandle,
2003 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2006 PciAttributesSaved =
FALSE;
2010 Status = PciIo->Attributes (
2014 &OriginalPciAttributes
2017 if (EFI_ERROR (Status)) {
2021 PciAttributesSaved =
TRUE;
2023 Status = PciIo->Attributes (
2029 if (!EFI_ERROR (Status)) {
2030 Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
2031 Status = PciIo->Attributes (
2039 if (EFI_ERROR (Status)) {
2040 DEBUG ((DEBUG_ERROR,
"XhcDriverBindingStart: failed to enable controller\n"));
2047 Xhc =
XhcCreateUsbHc (PciIo, HcDevicePath, OriginalPciAttributes);
2050 DEBUG ((DEBUG_ERROR,
"XhcDriverBindingStart: failed to create USB2_HC\n"));
2051 return EFI_OUT_OF_RESOURCES;
2059 Status = PciIo->Attributes (
2065 if (!EFI_ERROR (Status)) {
2066 Xhc->Support64BitDma =
TRUE;
2070 "%a: failed to enable 64-bit DMA on 64-bit capable controller @ %p (%r)\n",
2080 Status =
XhcResetHC (Xhc, XHC_RESET_TIMEOUT);
2081 if (EFI_ERROR (Status)) {
2082 DEBUG ((DEBUG_ERROR,
"%a: failed to reset HC\n", __func__));
2092 ASSERT (!(XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_CNR)));
2102 XhcRunHC (Xhc, XHC_GENERIC_TIMEOUT);
2107 Status =
gBS->SetTimer (Xhc->PollTimer,
TimerPeriodic, XHC_ASYNC_TIMER_INTERVAL);
2108 if (EFI_ERROR (Status)) {
2109 DEBUG ((DEBUG_ERROR,
"XhcDriverBindingStart: failed to start async interrupt monitor\n"));
2117 Status =
gBS->CreateEventEx (
2122 &gEfiEventExitBootServicesGuid,
2123 &Xhc->ExitBootServiceEvent
2125 if (EFI_ERROR (Status)) {
2136 &Xhc->ControllerNameTable,
2137 L
"eXtensible Host Controller (USB 3.0)",
2143 &Xhc->ControllerNameTable,
2144 L
"eXtensible Host Controller (USB 3.0)",
2148 Status =
gBS->InstallProtocolInterface (
2150 &gEfiUsb2HcProtocolGuid,
2154 if (EFI_ERROR (Status)) {
2155 DEBUG ((DEBUG_ERROR,
"XhcDriverBindingStart: failed to install USB2_HC Protocol\n"));
2159 DEBUG ((DEBUG_INFO,
"XhcDriverBindingStart: XHCI started for controller @ %x\n", Controller));
2163 gBS->CloseEvent (Xhc->PollTimer);
2168 if (PciAttributesSaved) {
2175 OriginalPciAttributes,
2180 gBS->CloseProtocol (
2182 &gEfiPciIoProtocolGuid,
2183 This->DriverBindingHandle,
2223 Status =
gBS->OpenProtocol (
2225 &gEfiUsb2HcProtocolGuid,
2227 This->DriverBindingHandle,
2229 EFI_OPEN_PROTOCOL_GET_PROTOCOL
2232 if (EFI_ERROR (Status)) {
2236 Status =
gBS->UninstallProtocolInterface (
2238 &gEfiUsb2HcProtocolGuid,
2242 if (EFI_ERROR (Status)) {
2246 Xhc = XHC_FROM_THIS (Usb2Hc);
2259 for (Index = 0; Index < 255; Index++) {
2260 if (!Xhc->UsbDevContext[Index + 1].Enabled ||
2261 (Xhc->UsbDevContext[Index + 1].SlotId == 0))
2273 if (Xhc->PollTimer !=
NULL) {
2274 gBS->CloseEvent (Xhc->PollTimer);
2277 if (Xhc->ExitBootServiceEvent !=
NULL) {
2278 gBS->CloseEvent (Xhc->ExitBootServiceEvent);
2286 if (Xhc->ControllerNameTable) {
2296 Xhc->OriginalPciAttributes,
2300 gBS->CloseProtocol (
2302 &gEfiPciIoProtocolGuid,
2303 This->DriverBindingHandle,
2329 if (!mXhciPerformanceCounterValuesCached) {
2331 &mXhciPerformanceCounterStartValue,
2332 &mXhciPerformanceCounterEndValue
2335 mXhciPerformanceCounterValuesCached =
TRUE;
2339 if (0 == mXhciPerformanceCounterFrequency) {
2344 Divisor = 1000000000;
2353 mXhciPerformanceCounterFrequency,
2384 IN OUT UINT64 *PreviousTick
2395 if (mXhciPerformanceCounterStartValue < mXhciPerformanceCounterEndValue) {
2399 if (*PreviousTick > CurrentTick) {
2400 Delta = (mXhciPerformanceCounterEndValue - *PreviousTick) + CurrentTick;
2402 Delta = CurrentTick - *PreviousTick;
2408 if (*PreviousTick < CurrentTick) {
2409 Delta = (mXhciPerformanceCounterStartValue - CurrentTick) + *PreviousTick;
2411 Delta = *PreviousTick - CurrentTick;
2418 *PreviousTick = CurrentTick;
UINT64 EFIAPI GetPerformanceCounterProperties(OUT UINT64 *StartValue OPTIONAL, OUT UINT64 *EndValue OPTIONAL)
UINT64 EFIAPI GetPerformanceCounter(VOID)
UINT64 EFIAPI MultU64x64(IN UINT64 Multiplicand, IN UINT64 Multiplier)
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI DivU64x64Remainder(IN UINT64 Dividend, IN UINT64 Divisor, OUT UINT64 *Remainder OPTIONAL)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
INTN EFIAPI HighBitSet64(IN UINT64 Operand)
INTN EFIAPI HighBitSet32(IN UINT32 Operand)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE
Clear for PCI controllers that can not genrate a DAC.
@ EfiPciIoAttributeOperationGet
@ EfiPciIoAttributeOperationEnable
@ EfiPciIoAttributeOperationSet
@ EfiPciIoAttributeOperationSupported
#define USB_PORT_STAT_C_CONNECTION
#define EFI_USB_SPEED_SUPER
4.8 Gb/s, USB 3.0 XHCI HC.
@ EfiUsbHcStateOperational
#define USB_PORT_STAT_CONNECTION
EFI_STATUS(EFIAPI * EFI_ASYNC_USB_TRANSFER_CALLBACK)(IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Status)
#define EFI_PROGRESS_CODE
EFI_STATUS EFIAPI AddUnicodeString2(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
EFI_STATUS EFIAPI XhcDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI XhcSetRootHubPortFeature(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
EFI_STATUS EFIAPI XhcReset(IN EFI_USB2_HC_PROTOCOL *This, IN UINT16 Attributes)
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 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 XhcGetRootHubPortStatus(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
EFI_STATUS EFIAPI XhcDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
UINT64 XhcGetElapsedTicks(IN OUT UINT64 *PreviousTick)
EFI_STATUS EFIAPI XhcSetState(IN EFI_USB2_HC_PROTOCOL *This, IN EFI_USB_HC_STATE State)
EFI_STATUS EFIAPI XhcClearRootHubPortFeature(IN EFI_USB2_HC_PROTOCOL *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
EFI_STATUS EFIAPI XhcGetCapability(IN EFI_USB2_HC_PROTOCOL *This, OUT UINT8 *MaxSpeed, OUT UINT8 *PortNumber, OUT UINT8 *Is64BitCapable)
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 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 XhcGetState(IN EFI_USB2_HC_PROTOCOL *This, OUT EFI_USB_HC_STATE *State)
USB_XHCI_INSTANCE * XhcCreateUsbHc(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 XhcDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
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 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)
UINT64 XhcConvertTimeToTicks(IN UINT64 Time)
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 XhcDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
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)
VOID XhciDelAllAsyncIntTransfers(IN USB_XHCI_INSTANCE *Xhc)
VOID XhcFreeUrb(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
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)
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 XhcRecoverHaltedEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
VOID EFIAPI XhcMonitorAsyncRequests(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI XhcDequeueTrbFromEndpoint(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
EFI_STATUS EFIAPI XhcEvaluateContext64(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT32 MaxPacketSize)
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)
VOID XhcInitSched(IN USB_XHCI_INSTANCE *Xhc)
EFI_STATUS RingIntTransferDoorBell(IN USB_XHCI_INSTANCE *Xhc, IN URB *Urb)
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 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 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)
EFI_STATUS XhcResetHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
BOOLEAN XhcIsSysError(IN USB_XHCI_INSTANCE *Xhc)
EFI_STATUS XhcRunHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
UINT32 XhcGetCapabilityAddr(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 CapId)
VOID XhcClearBiosOwnership(IN USB_XHCI_INSTANCE *Xhc)
EFI_STATUS XhcHaltHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
UINT16 XhcCheckUsbPortSpeedUsedPsic(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 PortSpeed, IN UINT8 PortNumber)
UINT32 XhcReadExtCapReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
VOID XhcWriteOpReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Data)
VOID XhcSetBiosOwnership(IN USB_XHCI_INSTANCE *Xhc)
UINT32 XhcGetSupportedProtocolCapabilityAddr(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 MajorVersion)
UINT32 XhcReadCapReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
UINT32 XhcReadOpReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
BOOLEAN XhcIsHalt(IN USB_XHCI_INSTANCE *Xhc)
UINT8 XhcReadCapReg8(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
EFI_STATUS XhcWaitOpRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
CHAR8 * SupportedLanguages
CHAR8 * SupportedLanguages
UINT8 CapLength
Capability Register Length.
XHC_HCSPARAMS2 HcSParams2
Structural Parameters 2.
UINT32 DBOff
Doorbell Offset.
XHC_HCCPARAMS HcCParams
Capability Parameters.
UINT32 RTSOff
Runtime Register Space Offset.
XHC_HCSPARAMS1 HcSParams1
Structural Parameters 1.
EFI_PCI_IO_PROTOCOL_CONFIG Read
UINT16 PortChangeStatus
Contains current port status change bitmap.
UINT16 PortStatus
Contains current port status bitmap.