19 { XHC_PORTSC_PED, USB_PORT_STAT_ENABLE },
20 { XHC_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
21 { XHC_PORTSC_PP, USB_PORT_STAT_POWER },
22 { XHC_PORTSC_RESET, USB_PORT_STAT_RESET }
27 { XHC_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
28 { XHC_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
29 { XHC_PORTSC_PRC, USB_PORT_STAT_C_RESET }
33 { XHC_PORTSC_CSC, EfiUsbPortConnectChange },
34 { XHC_PORTSC_PEC, EfiUsbPortEnableChange },
35 { XHC_PORTSC_OCC, EfiUsbPortOverCurrentChange },
36 { XHC_PORTSC_PRC, EfiUsbPortResetChange }
41 { XHC_HUB_PORTSC_PED, USB_PORT_STAT_ENABLE },
42 { XHC_HUB_PORTSC_OCA, USB_PORT_STAT_OVERCURRENT },
43 { XHC_HUB_PORTSC_PP, USB_PORT_STAT_POWER },
44 { XHC_HUB_PORTSC_RESET, USB_PORT_STAT_RESET }
49 { XHC_HUB_PORTSC_PEC, USB_PORT_STAT_C_ENABLE },
50 { XHC_HUB_PORTSC_OCC, USB_PORT_STAT_C_OVERCURRENT },
51 { XHC_HUB_PORTSC_PRC, USB_PORT_STAT_C_RESET }
55 { XHC_HUB_PORTSC_CSC, EfiUsbPortConnectChange },
56 { XHC_HUB_PORTSC_PEC, EfiUsbPortEnableChange },
57 { XHC_HUB_PORTSC_OCC, EfiUsbPortOverCurrentChange },
58 { XHC_HUB_PORTSC_PRC, EfiUsbPortResetChange },
59 { XHC_HUB_PORTSC_BHRC, Usb3PortBHPortResetChange }
79 ASSERT (Xhc->CapLength != 0);
81 Data =
MmioRead32 (Xhc->UsbHostControllerBaseAddress + Xhc->CapLength + Offset);
100 ASSERT (Xhc->CapLength != 0);
102 MmioWrite32 (Xhc->UsbHostControllerBaseAddress + Xhc->CapLength + Offset, Data);
168 IN BOOLEAN WaitToSet,
174 for (Index = 0; Index < Timeout * XHC_1_MILLISECOND; Index++) {
175 if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) == WaitToSet) {
202 Data =
MmioRead32 (Xhc->UsbHostControllerBaseAddress + Offset);
222 ASSERT (Xhc->DBOff != 0);
224 MmioWrite32 (Xhc->UsbHostControllerBaseAddress + Xhc->DBOff + Offset, Data);
244 ASSERT (Xhc->RTSOff != 0);
246 Data =
MmioRead32 (Xhc->UsbHostControllerBaseAddress + Xhc->RTSOff + Offset);
266 ASSERT (Xhc->RTSOff != 0);
268 MmioWrite32 (Xhc->UsbHostControllerBaseAddress + Xhc->RTSOff + Offset, Data);
329 return XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT);
346 return XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HSE);
373 if (EFI_ERROR (Status)) {
387 DEBUG ((DEBUG_INFO,
"XhcPeiResetHC: %r\n", Status));
411 DEBUG ((DEBUG_INFO,
"XhcPeiHaltHC: %r\n", Status));
435 DEBUG ((DEBUG_INFO,
"XhcPeiRunHC: %r\n", Status));
470 IN UINT8 DeviceAddress,
471 IN UINT8 DeviceSpeed,
479 OUT UINT32 *TransferResult
486 UINT8 DescriptorType;
503 if ((Request ==
NULL) || (TransferResult ==
NULL)) {
504 return EFI_INVALID_PARAMETER;
507 if ((TransferDirection != EfiUsbDataIn) &&
508 (TransferDirection != EfiUsbDataOut) &&
509 (TransferDirection != EfiUsbNoData))
511 return EFI_INVALID_PARAMETER;
514 if ((TransferDirection == EfiUsbNoData) &&
515 ((Data !=
NULL) || (*DataLength != 0)))
517 return EFI_INVALID_PARAMETER;
520 if ((TransferDirection != EfiUsbNoData) &&
521 ((Data ==
NULL) || (*DataLength == 0)))
523 return EFI_INVALID_PARAMETER;
526 if ((MaximumPacketLength != 8) && (MaximumPacketLength != 16) &&
527 (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&
528 (MaximumPacketLength != 512)
531 return EFI_INVALID_PARAMETER;
534 if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) {
535 return EFI_INVALID_PARAMETER;
539 return EFI_INVALID_PARAMETER;
542 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
544 Status = EFI_DEVICE_ERROR;
545 *TransferResult = EFI_USB_ERR_SYSTEM;
549 DEBUG ((DEBUG_ERROR,
"XhcPeiControlTransfer: HC is halted or has system error\n"));
565 if ((Request->Request == USB_REQ_SET_ADDRESS) &&
566 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)))
572 for (Index = 0; Index < 255; Index++) {
573 if (!Xhc->UsbDevContext[Index + 1].Enabled &&
574 (Xhc->UsbDevContext[Index + 1].SlotId == 0) &&
575 (Xhc->UsbDevContext[Index + 1].BusDevAddr == (UINT8)Request->Value))
577 Xhc->UsbDevContext[Index + 1].BusDevAddr = 0;
581 if (Xhc->UsbDevContext[SlotId].XhciDevAddr == 0) {
591 Xhc->UsbDevContext[SlotId].BusDevAddr = (UINT8)Request->Value;
603 Endpoint = (UINT8)(0 | ((TransferDirection == EfiUsbDataIn) ? 0x80 : 0));
619 DEBUG ((DEBUG_ERROR,
"XhcPeiControlTransfer: failed to create URB"));
620 Status = EFI_OUT_OF_RESOURCES;
630 *TransferResult = Urb->Result;
631 *DataLength = Urb->Completed;
633 if (Status == EFI_TIMEOUT) {
638 if (EFI_ERROR (RecoveryStatus)) {
639 DEBUG ((DEBUG_ERROR,
"XhcPeiControlTransfer: XhcPeiDequeueTrbFromEndpoint failed\n"));
645 if (*TransferResult == EFI_USB_NOERROR) {
647 }
else if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) {
649 if (EFI_ERROR (RecoveryStatus)) {
650 DEBUG ((DEBUG_ERROR,
"XhcPeiControlTransfer: XhcPeiRecoverHaltedEndpoint failed\n"));
653 Status = EFI_DEVICE_ERROR;
672 if ((Request->Request == USB_REQ_GET_DESCRIPTOR) &&
673 ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)) ||
674 ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_DEVICE)))))
676 DescriptorType = (UINT8)(Request->Value >> 8);
677 if ((DescriptorType == USB_DESC_TYPE_DEVICE) && ((*DataLength ==
sizeof (
EFI_USB_DEVICE_DESCRIPTOR)) || ((DeviceSpeed == EFI_USB_SPEED_FULL) && (*DataLength == 8)))) {
678 ASSERT (Data !=
NULL);
682 CopyMem (&Xhc->UsbDevContext[SlotId].DevDesc, Data, *DataLength);
683 if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB >= 0x0300) {
687 MaxPacket0 = 1 << Xhc->UsbDevContext[SlotId].DevDesc.MaxPacketSize0;
689 MaxPacket0 = Xhc->UsbDevContext[SlotId].DevDesc.MaxPacketSize0;
693 if (Xhc->UsbDevContext[SlotId].ConfDesc ==
NULL) {
694 Status = EFI_OUT_OF_RESOURCES;
703 }
else if (DescriptorType == USB_DESC_TYPE_CONFIG) {
704 ASSERT (Data !=
NULL);
705 if (*DataLength == ((UINT16 *)Data)[1]) {
709 Index = (UINT8)Request->Value;
710 ASSERT (Index < Xhc->UsbDevContext[SlotId].DevDesc.NumConfigurations);
711 Xhc->UsbDevContext[SlotId].ConfDesc[Index] =
AllocateZeroPool (*DataLength);
712 if (Xhc->UsbDevContext[SlotId].ConfDesc[Index] ==
NULL) {
713 Status = EFI_OUT_OF_RESOURCES;
717 CopyMem (Xhc->UsbDevContext[SlotId].ConfDesc[Index], Data, *DataLength);
719 }
else if (((DescriptorType == USB_DESC_TYPE_HUB) ||
720 (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) && (*DataLength > 2))
722 ASSERT (Data !=
NULL);
724 ASSERT (HubDesc->NumPorts <= 15);
728 TTT = (UINT8)((HubDesc->HubCharacter & (BIT5 | BIT6)) >> 5);
729 if (Xhc->UsbDevContext[SlotId].DevDesc.DeviceProtocol == 2) {
734 DEBUG ((DEBUG_ERROR,
"XHCI: Don't support multi-TT feature for Hub now. (force to disable MTT)\n"));
745 }
else if ((Request->Request == USB_REQ_SET_CONFIG) &&
746 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)))
751 for (Index = 0; Index < Xhc->UsbDevContext[SlotId].DevDesc.NumConfigurations; Index++) {
752 if (Xhc->UsbDevContext[SlotId].ConfDesc[Index]->ConfigurationValue == (UINT8)Request->Value) {
754 Status =
XhcPeiSetConfigCmd (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
756 Status =
XhcPeiSetConfigCmd64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
762 }
else if ((Request->Request == USB_REQ_GET_STATUS) &&
763 (Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_OTHER)))
765 ASSERT (Data !=
NULL);
769 State = *(UINT32 *)Data;
777 if ((State & XHC_PORTSC_PS) >> 10 == 0) {
778 PortStatus.
PortStatus |= USB_PORT_STAT_SUPER_SPEED;
784 if (XHC_BIT_IS_SET (State, BIT9)) {
785 PortStatus.
PortStatus |= USB_PORT_STAT_LOW_SPEED;
786 }
else if (XHC_BIT_IS_SET (State, BIT10)) {
787 PortStatus.
PortStatus |= USB_PORT_STAT_HIGH_SPEED;
795 for (Index = 0; Index < MapSize; Index++) {
796 if (XHC_BIT_IS_SET (State, mUsbHubPortStateMap[Index].HwState)) {
802 for (Index = 0; Index < MapSize; Index++) {
803 if (XHC_BIT_IS_SET (State, mUsbHubPortChangeMap[Index].HwState)) {
810 for (Index = 0; Index < MapSize; Index++) {
811 if (XHC_BIT_IS_SET (State, mUsbHubClearPortChangeMap[Index].HwState)) {
813 ClearPortRequest.RequestType = USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_CLASS, USB_TARGET_OTHER);
814 ClearPortRequest.Request = (UINT8)USB_REQ_CLEAR_FEATURE;
815 ClearPortRequest.Value = mUsbHubClearPortChangeMap[Index].Selector;
816 ClearPortRequest.Index = Request->Index;
817 ClearPortRequest.Length = 0;
838 *(UINT32 *)Data = *(UINT32 *)&PortStatus;
843 if (EFI_ERROR (Status)) {
844 DEBUG ((DEBUG_ERROR,
"XhcPeiControlTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
887 IN UINT8 DeviceAddress,
888 IN UINT8 EndPointAddress,
889 IN UINT8 DeviceSpeed,
891 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
893 IN OUT UINT8 *DataToggle,
896 OUT UINT32 *TransferResult
908 if ((DataLength ==
NULL) || (*DataLength == 0) ||
909 (Data ==
NULL) || (Data[0] ==
NULL) || (TransferResult ==
NULL))
911 return EFI_INVALID_PARAMETER;
914 if ((*DataToggle != 0) && (*DataToggle != 1)) {
915 return EFI_INVALID_PARAMETER;
918 if ((DeviceSpeed == EFI_USB_SPEED_LOW) ||
919 ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) ||
920 ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength > 512)) ||
923 return EFI_INVALID_PARAMETER;
926 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
928 *TransferResult = EFI_USB_ERR_SYSTEM;
929 Status = EFI_DEVICE_ERROR;
932 DEBUG ((DEBUG_ERROR,
"XhcPeiBulkTransfer: HC is halted or has system error\n"));
963 DEBUG ((DEBUG_ERROR,
"XhcPeiBulkTransfer: failed to create URB\n"));
964 Status = EFI_OUT_OF_RESOURCES;
970 *TransferResult = Urb->Result;
971 *DataLength = Urb->Completed;
973 if (Status == EFI_TIMEOUT) {
978 if (EFI_ERROR (RecoveryStatus)) {
979 DEBUG ((DEBUG_ERROR,
"XhcPeiBulkTransfer: XhcPeiDequeueTrbFromEndpoint failed\n"));
982 if (*TransferResult == EFI_USB_NOERROR) {
984 }
else if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) {
986 if (EFI_ERROR (RecoveryStatus)) {
987 DEBUG ((DEBUG_ERROR,
"XhcPeiBulkTransfer: XhcPeiRecoverHaltedEndpoint failed\n"));
990 Status = EFI_DEVICE_ERROR;
998 if (EFI_ERROR (Status)) {
999 DEBUG ((DEBUG_ERROR,
"XhcPeiBulkTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
1022 OUT UINT8 *PortNumber
1027 XhcDev = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
1029 if (PortNumber ==
NULL) {
1030 return EFI_INVALID_PARAMETER;
1033 *PortNumber = XhcDev->
HcSParams1.Data.MaxPorts;
1034 DEBUG ((DEBUG_INFO,
"XhcPeiGetRootHubPortNumber: PortNumber = %x\n", *PortNumber));
1058 IN UINT8 PortNumber,
1067 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
1070 if (PortNumber >= Xhc->
HcSParams1.Data.MaxPorts) {
1071 Status = EFI_INVALID_PARAMETER;
1075 Offset = (UINT32)(XHC_PORTSC_OFFSET + (0x10 * PortNumber));
1077 DEBUG ((DEBUG_INFO,
"XhcPeiClearRootHubPortFeature: Port: %x State: %x\n", PortNumber, State));
1083 State &= ~(BIT1 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | BIT23);
1085 switch (PortFeature) {
1086 case EfiUsbPortEnable:
1091 State |= XHC_PORTSC_PED;
1092 State &= ~XHC_PORTSC_RESET;
1096 case EfiUsbPortSuspend:
1097 State |= XHC_PORTSC_LWS;
1099 State &= ~XHC_PORTSC_PLS;
1103 case EfiUsbPortReset:
1111 case EfiUsbPortPower:
1116 State &= ~XHC_PORTSC_PP;
1122 case EfiUsbPortOwner:
1128 case EfiUsbPortConnectChange:
1132 State |= XHC_PORTSC_CSC;
1136 case EfiUsbPortEnableChange:
1140 State |= XHC_PORTSC_PEC;
1144 case EfiUsbPortOverCurrentChange:
1148 State |= XHC_PORTSC_OCC;
1152 case EfiUsbPortResetChange:
1156 State |= XHC_PORTSC_PRC;
1160 case EfiUsbPortSuspendChange:
1167 Status = EFI_INVALID_PARAMETER;
1172 DEBUG ((DEBUG_INFO,
"XhcPeiClearRootHubPortFeature: PortFeature: %x Status = %r\n", PortFeature, Status));
1194 IN UINT8 PortNumber,
1203 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
1206 if (PortNumber >= Xhc->
HcSParams1.Data.MaxPorts) {
1207 Status = EFI_INVALID_PARAMETER;
1211 Offset = (UINT32)(XHC_PORTSC_OFFSET + (0x10 * PortNumber));
1213 DEBUG ((DEBUG_INFO,
"XhcPeiSetRootHubPortFeature: Port: %x State: %x\n", PortNumber, State));
1219 State &= ~(BIT1 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | BIT23);
1221 switch (PortFeature) {
1222 case EfiUsbPortEnable:
1229 case EfiUsbPortSuspend:
1230 State |= XHC_PORTSC_LWS;
1232 State &= ~XHC_PORTSC_PLS;
1237 case EfiUsbPortReset:
1243 if (EFI_ERROR (Status)) {
1254 State |= XHC_PORTSC_RESET;
1259 case EfiUsbPortPower:
1264 State |= XHC_PORTSC_PP;
1270 case EfiUsbPortOwner:
1277 Status = EFI_INVALID_PARAMETER;
1281 DEBUG ((DEBUG_INFO,
"XhcPeiSetRootHubPortFeature: PortFeature: %x Status = %r\n", PortFeature, Status));
1303 IN UINT8 PortNumber,
1314 if (PortStatus ==
NULL) {
1315 return EFI_INVALID_PARAMETER;
1318 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS (This);
1320 if (PortNumber >= Xhc->
HcSParams1.Data.MaxPorts) {
1321 return EFI_INVALID_PARAMETER;
1327 PortStatus->PortStatus = 0;
1328 PortStatus->PortChangeStatus = 0;
1330 Offset = (UINT32)(XHC_PORTSC_OFFSET + (0x10 * PortNumber));
1332 DEBUG ((DEBUG_INFO,
"XhcPeiGetRootHubPortStatus: Port: %x State: %x\n", PortNumber, State));
1338 switch ((State & XHC_PORTSC_PS) >> 10) {
1340 PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
1344 PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
1349 PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
1361 for (Index = 0; Index < MapSize; Index++) {
1362 if (XHC_BIT_IS_SET (State, mUsbPortStateMap[Index].HwState)) {
1363 PortStatus->PortStatus = (UINT16)(PortStatus->PortStatus | mUsbPortStateMap[Index].UefiState);
1370 if ((State & XHC_PORTSC_PLS) >> 5 == 3) {
1371 PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
1376 for (Index = 0; Index < MapSize; Index++) {
1377 if (XHC_BIT_IS_SET (State, mUsbPortChangeMap[Index].HwState)) {
1378 PortStatus->PortChangeStatus = (UINT16)(PortStatus->PortChangeStatus | mUsbPortChangeMap[Index].UefiState);
1384 for (Index = 0; Index < MapSize; Index++) {
1385 if (XHC_BIT_IS_SET (State, mUsbClearPortChangeMap[Index].HwState)) {
1394 ParentRouteChart.Dword = 0;
1397 DEBUG ((DEBUG_INFO,
"XhcPeiGetRootHubPortStatus: PortChangeStatus: %x PortStatus: %x\n", PortStatus->PortChangeStatus, PortStatus->PortStatus));
1422 Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS_NOTIFY (NotifyDescriptor);
1448 UINTN ControllerType;
1463 &gPeiUsbControllerPpiGuid,
1466 (VOID **)&UsbControllerPpi
1468 if (EFI_ERROR (Status)) {
1469 return EFI_UNSUPPORTED;
1476 Status = UsbControllerPpi->GetUsbController (
1486 if (EFI_ERROR (Status)) {
1504 if (EFI_ERROR (Status)) {
1505 return EFI_OUT_OF_RESOURCES;
1511 XhcDev->Signature = USB_XHC_DEV_SIGNATURE;
1512 XhcDev->UsbHostControllerBaseAddress = (UINT32)BaseAddress;
1525 PageSize =
XhcPeiReadOpReg (XhcDev, XHC_PAGESIZE_OFFSET) & XHC_PAGESIZE_MASK;
1526 XhcDev->PageSize = 1 << (
HighBitSet32 (PageSize) + 12);
1528 DEBUG ((DEBUG_INFO,
"XhciPei: UsbHostControllerBaseAddress: %x\n", XhcDev->UsbHostControllerBaseAddress));
1529 DEBUG ((DEBUG_INFO,
"XhciPei: CapLength: %x\n", XhcDev->
CapLength));
1530 DEBUG ((DEBUG_INFO,
"XhciPei: HcSParams1: %x\n", XhcDev->
HcSParams1.Dword));
1531 DEBUG ((DEBUG_INFO,
"XhciPei: HcSParams2: %x\n", XhcDev->
HcSParams2.Dword));
1532 DEBUG ((DEBUG_INFO,
"XhciPei: HcCParams: %x\n", XhcDev->
HcCParams.Dword));
1533 DEBUG ((DEBUG_INFO,
"XhciPei: DBOff: %x\n", XhcDev->
DBOff));
1534 DEBUG ((DEBUG_INFO,
"XhciPei: RTSOff: %x\n", XhcDev->
RTSOff));
1535 DEBUG ((DEBUG_INFO,
"XhciPei: PageSize: %x\n", XhcDev->PageSize));
1562 XhcDev->PpiDescriptor.
Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
1563 XhcDev->PpiDescriptor.
Guid = &gPeiUsb2HostControllerPpiGuid;
1564 XhcDev->PpiDescriptor.
Ppi = &XhcDev->Usb2HostControllerPpi;
1566 XhcDev->EndOfPeiNotifyList.
Flags = (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
1567 XhcDev->EndOfPeiNotifyList.
Guid = &gEfiEndOfPeiSignalPpiGuid;
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
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)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
EFI_STATUS EFIAPI PeiServicesRegisterForShadow(IN EFI_PEI_FILE_HANDLE FileHandle)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
#define DEBUG(Expression)
#define USB_PORT_STAT_C_CONNECTION
#define EFI_USB_SPEED_SUPER
4.8 Gb/s, USB 3.0 XHCI HC.
#define USB_PORT_STAT_CONNECTION
VOID IoMmuInit(OUT EDKII_IOMMU_PPI **IoMmu)
VOID * EFI_PEI_FILE_HANDLE
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_PAGES_TO_SIZE(Pages)
#define EFI_SIZE_TO_PAGES(Size)
#define PEI_XHCI_CONTROLLER
VOID XhcPeiSetOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
UINT32 XhcPeiReadCapRegister(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset)
BOOLEAN XhcPeiIsHalt(IN PEI_XHC_DEV *Xhc)
EFI_STATUS EFIAPI XhcPeiBulkTransfer(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 DeviceSpeed, IN UINTN MaximumPacketLength, 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)
VOID XhcPeiClearRuntimeRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
UINT32 XhcPeiReadOpReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset)
EFI_STATUS EFIAPI XhcPeiGetRootHubPortNumber(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *This, OUT UINT8 *PortNumber)
EFI_STATUS XhcPeiRunHC(IN PEI_XHC_DEV *Xhc, IN UINT32 Timeout)
EFI_STATUS XhcPeiHaltHC(IN PEI_XHC_DEV *Xhc, IN UINT32 Timeout)
EFI_STATUS XhcPeiWaitOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
BOOLEAN XhcPeiIsSysError(IN PEI_XHC_DEV *Xhc)
EFI_STATUS EFIAPI XhcPeiGetRootHubPortStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
EFI_STATUS EFIAPI XhcPeimEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
EFI_STATUS EFIAPI XhcPeiClearRootHubPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
VOID XhcPeiWriteOpReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Data)
EFI_STATUS EFIAPI XhcEndOfPei(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
VOID XhcPeiSetRuntimeRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
EFI_STATUS EFIAPI XhcPeiControlTransfer(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *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)
UINT32 XhcPeiReadRuntimeReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset)
VOID XhcPeiClearOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
EFI_STATUS XhcPeiResetHC(IN PEI_XHC_DEV *Xhc, IN UINT32 Timeout)
VOID XhcPeiWriteDoorBellReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Data)
VOID XhcPeiWriteRuntimeReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Data)
EFI_STATUS EFIAPI XhcPeiSetRootHubPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB2_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
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 XhcPeiRecoverHaltedEndpoint(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
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)
VOID XhcPeiFreeUrb(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
EFI_STATUS XhcPeiConfigHubContext64(IN PEI_XHC_DEV *Xhc, IN UINT8 SlotId, IN UINT8 PortNum, IN UINT8 TTT, IN UINT8 MTT)
UINT8 XhcPeiBusDevAddrToSlotId(IN PEI_XHC_DEV *Xhc, IN UINT8 BusDevAddr)
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)
EFI_STATUS XhcPeiExecTransfer(IN PEI_XHC_DEV *Xhc, IN BOOLEAN CmdTransfer, IN URB *Urb, IN UINTN Timeout)
EFI_STATUS XhcPeiDequeueTrbFromEndpoint(IN PEI_XHC_DEV *Xhc, IN URB *Urb)
EFI_STATUS XhcPeiPollPortStatusChange(IN PEI_XHC_DEV *Xhc, IN USB_DEV_ROUTE ParentRouteChart, IN UINT8 Port, IN EFI_USB_PORT_STATUS *PortState)
EFI_PEIM_NOTIFY_ENTRY_POINT Notify
XHC_HCSPARAMS1 HcSParams1
Structural Parameters 1.
UINT32 DBOff
Doorbell Offset.
UINT32 RTSOff
Runtime Register Space Offset.
UINT8 CapLength
Capability Register Length.
XHC_HCSPARAMS2 HcSParams2
Structural Parameters 2.
XHC_HCCPARAMS HcCParams
Capability Parameters.
UINT16 PortChangeStatus
Contains current port status change bitmap.
UINT16 PortStatus
Contains current port status bitmap.